Skip to content

Commit a386a5d

Browse files
committed
some code formatting
1 parent 61a4330 commit a386a5d

File tree

4 files changed

+52
-44
lines changed

4 files changed

+52
-44
lines changed

src/app/space.coffee

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
'use strict'
1+
22
React = require('react')
33
div = React.DOM.div
4-
module.exports = React.createClass(
4+
module.exports = React.createClass
55
displayName: 'app-space'
66
propTypes:
77
width: React.PropTypes.number
88
height: React.PropTypes.number
9+
910
render: ->
1011
div style: @styleRoot()
12+
1113
styleRoot: ->
12-
{
13-
width: @props.width or '100%'
14-
height: @props.height or '1em'
15-
}
16-
)
14+
width: @props.width or '100%'
15+
height: @props.height or '1em'

src/app/spinner.coffee

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
'use strict'
1+
22
React = require('react')
33
div = React.DOM.div
4-
module.exports = React.createClass(
4+
5+
module.exports = React.createClass
56
displayName: 'app-spinner'
7+
68
render: ->
7-
div {
9+
div
810
style: @styleRoot()
911
className: 'spinner'
10-
}, div(className: 'cube1'), div(className: 'cube2')
12+
div className: 'cube1'
13+
div className: 'cube2'
14+
1115
styleRoot: ->
12-
{}
13-
)
16+
{}

src/app/time.coffee

+30-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'
1+
22
hsl = require('hsl')
33
React = require('react')
44
reset = require('../util/reset')
@@ -7,9 +7,12 @@ now = new Date
77
thisYear = now.getFullYear()
88
thisMonth = now.getMonth()
99
thisDay = now.getDate()
10-
module.exports = React.createClass(
10+
11+
module.exports = React.createClass
1112
displayName: 'app-time'
12-
propTypes: time: React.PropTypes.string.isRequired
13+
propTypes:
14+
time: React.PropTypes.string.isRequired
15+
1316
getTime: ->
1417
thatTime = new Date(@props.time)
1518
current = new Date
@@ -20,28 +23,29 @@ module.exports = React.createClass(
2023
thatMin = thatTime.getMinutes()
2124
currentHour = current.getHours()
2225
currentMin = current.getMinutes()
23-
if thatYear != thisYear
24-
return thatYear + '/' + thatMonth + '/' + thatDay
25-
if thatMonth != thisMonth
26-
return thisMonth + '/' + thatDay
27-
if thatDay != thisDay
28-
return '' + thisDay - thatDay + ' ' + 'days'
29-
if thatHour != currentHour
30-
return thatHour + ':' + thatMin
31-
if thatMin != currentMin
32-
return thatHour + ':' + thatMin
33-
'now'
26+
27+
switch
28+
when thatYear isnt thisYear
29+
"#{thatYear}/#{thatMonth}/#{thatDay}"
30+
when thatMonth isnt thisMonth
31+
"#{thisMonth}/#{thatDay}"
32+
when thatDay isnt thisDay
33+
"#{thisDay - thatDay}days"
34+
when thatHour isnt currentHour
35+
"#{thatHour}:#{thatMin}"
36+
when thatMin isnt currentMin
37+
"#{thatHour}:#{thatMin}"
38+
else 'now'
39+
3440
render: ->
35-
div { style: @styleRoot() }, @getTime()
41+
div style: @styleRoot(), @getTime()
42+
3643
styleRoot: ->
37-
{
38-
color: hsl(0, 0, 86)
39-
fontFamily: reset.fashionFonts
40-
padding: '0 0px'
41-
lineHeight: '18px'
42-
height: '18px'
43-
fontSize: '12px'
44-
borderRadius: 2
45-
whiteSpace: 'nowrap'
46-
}
47-
)
44+
color: hsl(0, 0, 86)
45+
fontFamily: reset.fashionFonts
46+
padding: '0 0px'
47+
lineHeight: '18px'
48+
height: '18px'
49+
fontSize: '12px'
50+
borderRadius: 2
51+
whiteSpace: 'nowrap'

src/app/title.coffee

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
'use strict'
1+
22
React = require('react')
33
div = React.DOM.div
4-
module.exports = React.createClass(
4+
5+
module.exports = React.createClass
56
displayName: 'app-avatar'
6-
propTypes: title: React.PropTypes.string.isRequired
7+
propTypes:
8+
title: React.PropTypes.string.isRequired
9+
710
renderTitle: ->
811
if document.title != @props.title
912
document.title = @props.title
10-
undefined
13+
1114
render: ->
1215
@renderTitle()
1316
div {}
14-
)

0 commit comments

Comments
 (0)