-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDateRow.js
56 lines (52 loc) · 1.37 KB
/
DateRow.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from 'react'
import Add from 'material-ui/svg-icons/content/add';
export default ({...props})=>{
const {
cellComponent,
cellStyle,
rowIndex,
key,
shift,
numDays,
zDepth,
onMouseDown,
oldShift,
onTouchDown,
onDoubleClick,
selected
} = props;
const listCells= [...Array(numDays)].map((element,index)=>{
let selected_cell = selected.some((element)=>{
return (element == `r${rowIndex}c${index}`)
})
let positioned_cell_style = {
...cellStyle,
cursor:'pointer',
backgroundColor: selected_cell ? '#3F51B5':(index%2 ? '#C5CAE9':'#E8EAF6'),
paddingTop:`${cellStyle.height/3}px`
}
return(
cellComponent({
id:`r${rowIndex}c${index}`,
key:index,
style:positioned_cell_style,
})
)
})
return (
<div
onMouseDown={onMouseDown}
onTouchStart={onTouchDown}
onDoubleClick={onDoubleClick}
style={
{
display:'inline-block',
position: 'absolute',
left:shift+oldShift,
top: `${rowIndex*(cellStyle.height+2*cellStyle.margin)}px`
}
}>
{listCells}
</div>
)
}