Skip to content

Commit dd96aea

Browse files
authored
Merge pull request #1916 from wix/fix/Timeline_styles
Fix Timeline styles
2 parents a1cd1a1 + ab64308 commit dd96aea

File tree

4 files changed

+76
-105
lines changed

4 files changed

+76
-105
lines changed

src/timeline/Timeline.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ const Timeline = (props: TimelineProps) => {
243243
<ScrollView
244244
// @ts-expect-error
245245
ref={scrollView}
246+
style={styles.current.container}
246247
contentContainerStyle={[styles.current.contentStyle, {width: constants.screenWidth}]}
248+
showsVerticalScrollIndicator={false}
247249
{...scrollEvents}
248250
>
249251
<TimelineHours

src/timeline/style.ts

Lines changed: 72 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,116 @@
1-
// @flow
21
import {StyleSheet} from 'react-native';
2+
import * as defaultStyle from '../style';
33
import {Theme} from '../types';
44
import constants from '../commons/constants';
55

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';
711

812
export default function styleConstructor(theme: Theme = {}, calendarHeight: number) {
13+
const appStyle = {...defaultStyle, ...theme};
14+
915
return StyleSheet.create({
1016
container: {
11-
flex: 1,
12-
backgroundColor: '#ffff',
13-
...theme.container
17+
backgroundColor: appStyle.calendarBackground,
18+
...appStyle.timelineContainer,
1419
},
1520
contentStyle: {
16-
backgroundColor: '#ffff',
17-
height: calendarHeight + 10,
18-
...theme.contentStyle,
21+
backgroundColor: appStyle.calendarBackground,
22+
...appStyle.contentStyle,
1923
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
8925
},
9026
line: {
9127
height: 1,
92-
position: 'absolute',
93-
backgroundColor: 'rgb(216,216,216)',
94-
...theme.line
28+
backgroundColor: LINE_COLOR,
29+
...theme.line,
30+
position: 'absolute'
9531
},
9632
verticalLine: {
97-
position: 'absolute',
9833
width: 1,
99-
height: '105%',
100-
backgroundColor: 'rgb(216,216,216)'
34+
backgroundColor: LINE_COLOR,
35+
...appStyle.verticalLine,
36+
position: 'absolute',
37+
height: '105%'
10138
},
10239
nowIndicator: {
10340
position: 'absolute',
10441
right: 0
10542
},
10643
nowIndicatorLine: {
10744
height: 1,
45+
backgroundColor: NOW_INDICATOR_COLOR,
46+
...appStyle.nowIndicatorLine,
10847
position: 'absolute',
10948
left: 0,
110-
right: 0,
111-
backgroundColor: 'red',
112-
...theme.nowIndicatorLine
49+
right: 0
11350
},
11451
nowIndicatorKnob: {
115-
position: 'absolute',
116-
left: -3,
117-
top: -3,
11852
width: 7,
11953
height: 7,
12054
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
12360
},
12461
timeLabel: {
125-
position: 'absolute',
126-
color: 'rgb(170,170,170)',
62+
color: TIME_LABEL_COLOR,
12763
fontSize: 10,
128-
fontFamily: constants.isIOS ? 'Helvetica Neue' : 'Roboto',
12964
fontWeight: '500',
65+
fontFamily: constants.isIOS ? 'Helvetica Neue' : 'Roboto',
13066
paddingLeft: 12,
13167
textAlign: 'center',
132-
...theme.timeLabel
68+
...appStyle.timeLabel,
69+
position: 'absolute'
13370
},
13471
unavailableHoursBlock: {
13572
position: 'absolute',
13673
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
138114
}
139115
});
140116
}

src/timeline/timeline.api.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
"type": "Theme",
1414
"description": "Specify theme properties to override specific styles for calendar parts"
1515
},
16-
{
17-
"name": "style",
18-
"type": "ViewStyle",
19-
"description": "Specify style for calendar container element"
20-
},
2116
{
2217
"name": "events",
2318
"type": "Event[]",

src/types.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ export type DateData = {
1111
dateString: string;
1212
};
1313
export interface Theme {
14-
container?: object;
14+
timelineContainer?: object;
1515
contentStyle?: ViewStyle;
16-
header?: object;
17-
headerText?: object;
18-
arrowButton?: object;
1916
event?: object;
2017
eventTitle?: object;
2118
eventSummary?: object;
2219
eventTimes?: object;
2320
line?: object;
21+
verticalLine?: object;
2422
nowIndicatorLine?: object;
2523
nowIndicatorKnob?: object;
2624
timeLabel?: object;

0 commit comments

Comments
 (0)