MessageTimestamp now has 12 hour prop

This commit is contained in:
Kieran Gould 2017-05-19 22:29:06 +01:00
parent 1ebe819aa2
commit cae62c8383
2 changed files with 17 additions and 18 deletions

View File

@ -23,21 +23,16 @@ const DateUtils = require('matrix-react-sdk/lib/DateUtils');
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'MessageTimestamp', displayName: 'MessageTimestamp',
propTypes: {
showTwelveHour: React.PropTypes.bool,
},
render: function() { render: function() {
var date = new Date(this.props.ts); const date = new Date(this.props.ts);
if (UserSettingsStore.getSyncedSetting('showTwelveHourTimestamps')) {
return (
<span style={{ textAlign: 'center' }} className="mx_MessageTimestamp" title={ DateUtils.formatFullDate(date) }>
{ DateUtils.formatTime(date) }
</span>
);
}
else {
return ( return (
<span className="mx_MessageTimestamp" title={ DateUtils.formatFullDate(date) }> <span className="mx_MessageTimestamp" title={ DateUtils.formatFullDate(date) }>
{ DateUtils.formatTime(date) } { DateUtils.formatTime(date, this.props.showTwelveHour) }
</span> </span>
); );
}
}, },
}); });

View File

@ -94,7 +94,7 @@ limitations under the License.
*/ */
.mx_EventTile_selected .mx_EventTile_line { .mx_EventTile_selected .mx_EventTile_line {
border-left: $accent-color 5px solid; border-left: $accent-color 5px solid;
padding-left: 60px; padding-left: px;
background-color: $event-selected-color; background-color: $event-selected-color;
} }
@ -263,10 +263,14 @@ limitations under the License.
cursor: pointer; cursor: pointer;
} }
.mx_EventTile_e2eIcon_12hr { .mx_EventTile_12hr .mx_EventTile_e2eIcon {
padding-left: 5px; padding-left: 5px;
} }
.mx_EventTile_12hr .mx_MessageTimestamp {
text-align: center;
}
.mx_EventTile:hover.mx_EventTile_verified .mx_EventTile_line, .mx_EventTile:hover.mx_EventTile_verified .mx_EventTile_line,
.mx_EventTile:hover.mx_EventTile_unverified .mx_EventTile_line { .mx_EventTile:hover.mx_EventTile_unverified .mx_EventTile_line {
padding-left: 60px; padding-left: 60px;