|
1 | | -// @flow |
2 | 1 | import {StyleSheet} from 'react-native'; |
| 2 | +import * as defaultStyle from '../style'; |
3 | 3 | import {Theme} from '../types'; |
4 | 4 | import constants from '../commons/constants'; |
5 | 5 |
|
6 | | -// const eventPaddingLeft = 4 |
| 6 | +const LINE_COLOR = '#D8D8D8'; |
| 7 | +const TIME_LABEL_COLOR = '#AAAAAA'; |
| 8 | +const EVENT_TEXT_COLOR = '#615B73'; |
| 9 | +const NOW_INDICATOR_COLOR = 'red'; |
| 10 | +const UNAVAILABLE_HOURS_BLOCK_COLOR = '#F8F9FA'; |
7 | 11 |
|
8 | 12 | export default function styleConstructor(theme: Theme = {}, calendarHeight: number) { |
| 13 | + const appStyle = {...defaultStyle, ...theme}; |
| 14 | + |
9 | 15 | return StyleSheet.create({ |
10 | 16 | container: { |
11 | | - flex: 1, |
12 | | - backgroundColor: '#ffff', |
13 | | - ...theme.container |
| 17 | + backgroundColor: appStyle.calendarBackground, |
| 18 | + ...appStyle.timelineContainer, |
14 | 19 | }, |
15 | 20 | contentStyle: { |
16 | | - backgroundColor: '#ffff', |
17 | | - height: calendarHeight + 10, |
18 | | - ...theme.contentStyle, |
| 21 | + backgroundColor: appStyle.calendarBackground, |
| 22 | + ...appStyle.contentStyle, |
19 | 23 | flexDirection: 'row', |
20 | | - }, |
21 | | - header: { |
22 | | - paddingHorizontal: 30, |
23 | | - height: 50, |
24 | | - borderTopWidth: 1, |
25 | | - borderBottomWidth: 1, |
26 | | - borderColor: '#E6E8F0', |
27 | | - backgroundColor: '#F5F5F6', |
28 | | - flexDirection: 'row', |
29 | | - justifyContent: 'space-between', |
30 | | - alignItems: 'stretch', |
31 | | - ...theme.header |
32 | | - }, |
33 | | - headerTextContainer: { |
34 | | - justifyContent: 'center' |
35 | | - }, |
36 | | - headerText: { |
37 | | - fontSize: 16, |
38 | | - ...theme.headerText |
39 | | - }, |
40 | | - arrow: { |
41 | | - width: 15, |
42 | | - height: 15, |
43 | | - resizeMode: 'contain' |
44 | | - }, |
45 | | - arrowButton: { |
46 | | - width: 50, |
47 | | - alignItems: 'center', |
48 | | - justifyContent: 'center', |
49 | | - ...theme.arrowButton |
50 | | - }, |
51 | | - event: { |
52 | | - position: 'absolute', |
53 | | - backgroundColor: '#F0F4FF', |
54 | | - borderColor: '#DDE5FD', |
55 | | - borderWidth: 1, |
56 | | - paddingLeft: 4, |
57 | | - minHeight: 25, |
58 | | - flex: 1, |
59 | | - opacity: 1, |
60 | | - paddingTop: 5, |
61 | | - paddingBottom: 0, |
62 | | - flexDirection: 'column', |
63 | | - alignItems: 'flex-start', |
64 | | - overflow: 'hidden', |
65 | | - ...theme.event |
66 | | - }, |
67 | | - eventTitle: { |
68 | | - color: '#615B73', |
69 | | - fontWeight: '600', |
70 | | - minHeight: 15, |
71 | | - ...theme.eventTitle |
72 | | - }, |
73 | | - eventSummary: { |
74 | | - color: '#615B73', |
75 | | - fontSize: 12, |
76 | | - flexWrap: 'wrap', |
77 | | - ...theme.eventSummary |
78 | | - }, |
79 | | - eventTimes: { |
80 | | - marginTop: 3, |
81 | | - fontSize: 10, |
82 | | - fontWeight: 'bold', |
83 | | - color: '#615B73', |
84 | | - flexWrap: 'wrap', |
85 | | - ...theme.eventTimes |
86 | | - }, |
87 | | - eventsContainer: { |
88 | | - flex: 1 |
| 24 | + height: calendarHeight + 10 |
89 | 25 | }, |
90 | 26 | line: { |
91 | 27 | height: 1, |
92 | | - position: 'absolute', |
93 | | - backgroundColor: 'rgb(216,216,216)', |
94 | | - ...theme.line |
| 28 | + backgroundColor: LINE_COLOR, |
| 29 | + ...theme.line, |
| 30 | + position: 'absolute' |
95 | 31 | }, |
96 | 32 | verticalLine: { |
97 | | - position: 'absolute', |
98 | 33 | width: 1, |
99 | | - height: '105%', |
100 | | - backgroundColor: 'rgb(216,216,216)' |
| 34 | + backgroundColor: LINE_COLOR, |
| 35 | + ...appStyle.verticalLine, |
| 36 | + position: 'absolute', |
| 37 | + height: '105%' |
101 | 38 | }, |
102 | 39 | nowIndicator: { |
103 | 40 | position: 'absolute', |
104 | 41 | right: 0 |
105 | 42 | }, |
106 | 43 | nowIndicatorLine: { |
107 | 44 | height: 1, |
| 45 | + backgroundColor: NOW_INDICATOR_COLOR, |
| 46 | + ...appStyle.nowIndicatorLine, |
108 | 47 | position: 'absolute', |
109 | 48 | left: 0, |
110 | | - right: 0, |
111 | | - backgroundColor: 'red', |
112 | | - ...theme.nowIndicatorLine |
| 49 | + right: 0 |
113 | 50 | }, |
114 | 51 | nowIndicatorKnob: { |
115 | | - position: 'absolute', |
116 | | - left: -3, |
117 | | - top: -3, |
118 | 52 | width: 7, |
119 | 53 | height: 7, |
120 | 54 | borderRadius: 4, |
121 | | - backgroundColor: 'red', |
122 | | - ...theme.nowIndicatorKnob |
| 55 | + backgroundColor: NOW_INDICATOR_COLOR, |
| 56 | + ...appStyle.nowIndicatorKnob, |
| 57 | + position: 'absolute', |
| 58 | + left: -3, |
| 59 | + top: -3 |
123 | 60 | }, |
124 | 61 | timeLabel: { |
125 | | - position: 'absolute', |
126 | | - color: 'rgb(170,170,170)', |
| 62 | + color: TIME_LABEL_COLOR, |
127 | 63 | fontSize: 10, |
128 | | - fontFamily: constants.isIOS ? 'Helvetica Neue' : 'Roboto', |
129 | 64 | fontWeight: '500', |
| 65 | + fontFamily: constants.isIOS ? 'Helvetica Neue' : 'Roboto', |
130 | 66 | paddingLeft: 12, |
131 | 67 | textAlign: 'center', |
132 | | - ...theme.timeLabel |
| 68 | + ...appStyle.timeLabel, |
| 69 | + position: 'absolute' |
133 | 70 | }, |
134 | 71 | unavailableHoursBlock: { |
135 | 72 | position: 'absolute', |
136 | 73 | right: 0, |
137 | | - backgroundColor: '#F8F9FA' |
| 74 | + backgroundColor: UNAVAILABLE_HOURS_BLOCK_COLOR |
| 75 | + }, |
| 76 | + event: { |
| 77 | + opacity: 1, |
| 78 | + paddingLeft: 4, |
| 79 | + paddingTop: 5, |
| 80 | + paddingBottom: 0, |
| 81 | + backgroundColor: '#F0F4FF', |
| 82 | + borderColor: '#DDE5FD', |
| 83 | + borderWidth: 1, |
| 84 | + ...appStyle.event, |
| 85 | + position: 'absolute', |
| 86 | + flex: 1, |
| 87 | + flexDirection: 'column', |
| 88 | + alignItems: 'flex-start', |
| 89 | + overflow: 'hidden', |
| 90 | + minHeight: 25, |
| 91 | + }, |
| 92 | + eventTitle: { |
| 93 | + color: EVENT_TEXT_COLOR, |
| 94 | + fontWeight: '600', |
| 95 | + ...appStyle.eventTitle, |
| 96 | + minHeight: 15 |
| 97 | + }, |
| 98 | + eventSummary: { |
| 99 | + color: EVENT_TEXT_COLOR, |
| 100 | + fontSize: 12, |
| 101 | + ...appStyle.eventSummary, |
| 102 | + flexWrap: 'wrap' |
| 103 | + }, |
| 104 | + eventTimes: { |
| 105 | + marginTop: 3, |
| 106 | + color: EVENT_TEXT_COLOR, |
| 107 | + fontSize: 10, |
| 108 | + fontWeight: 'bold', |
| 109 | + ...appStyle.eventTimes, |
| 110 | + flexWrap: 'wrap' |
| 111 | + }, |
| 112 | + eventsContainer: { |
| 113 | + flex: 1 |
138 | 114 | } |
139 | 115 | }); |
140 | 116 | } |
0 commit comments