rsnext/examples/with-mobx/components/Clock.js
Florian Didron 13feb8855d Adds mobx example (#676)
* Adds mobx example

* Fix coding style to match JS Standard

* Removes unecessary link

* Update README.md

* Update README.md

* Change next version from beta to ^2.0.0-beta

* Assigns the store to a local var

* Adds navigation in the example

* Removes unecessary imports

* Fix coding style to match JS Standard

* Fix Clock import
2017-01-06 03:38:51 -08:00

24 lines
565 B
JavaScript

export default (props) => {
return (
<div className={props.light ? 'light' : ''}>
{format(new Date(props.lastUpdate))}
<style jsx>{`
div {
padding: 15px;
color: #82FA58;
display: inline-block;
font: 50px menlo, monaco, monospace;
background-color: #000;
}
.light {
background-color: #999;
}
`}</style>
</div>
)
}
const format = t => `${pad(t.getHours())}:${pad(t.getMinutes())}:${pad(t.getSeconds())}`
const pad = n => n < 10 ? `0${n}` : n