mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
add: show last updated date on detail top bar
This commit is contained in:
27
browser/main/Detail/LastUpdatedString.js
Normal file
27
browser/main/Detail/LastUpdatedString.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @fileoverview Component for show updated date of the detail.
|
||||
*/
|
||||
import React, { PropTypes } from 'react'
|
||||
import { getLastUpdated } from 'browser/lib/date-formatter'
|
||||
import CSSModules from 'browser/lib/CSSModules'
|
||||
import styles from './LastUpdatedString.styl'
|
||||
|
||||
const LastUpdatedString = ({ date }) => {
|
||||
let text = ''
|
||||
|
||||
try {
|
||||
text = `Last updated at ${getLastUpdated(date)}`
|
||||
} catch (e) {
|
||||
text = ''
|
||||
}
|
||||
|
||||
return (
|
||||
<p styleName='info-right-date'>{text}</p>
|
||||
)
|
||||
}
|
||||
|
||||
LastUpdatedString.propTypes = {
|
||||
date: PropTypes.string,
|
||||
}
|
||||
|
||||
export default CSSModules(LastUpdatedString, styles)
|
||||
Reference in New Issue
Block a user