|
1 | 1 | import React from "react"; |
2 | 2 | import PropTypes from "prop-types"; |
3 | 3 | import { Text, View, Image, TouchableOpacity } from "react-native"; |
4 | | -import styles from "./AppleHeader.style"; |
| 4 | +import styles, { |
| 5 | + container, |
| 6 | + _dateTitleStyle, |
| 7 | + _largeTitleStyle |
| 8 | +} from "./AppleHeader.style"; |
5 | 9 |
|
6 | 10 | const AppleHeader = props => { |
7 | | - const { dateTitle, largeTitle, imageSource, onPress } = props; |
| 11 | + const { |
| 12 | + onPress, |
| 13 | + dateTitle, |
| 14 | + largeTitle, |
| 15 | + avatarStyle, |
| 16 | + imageSource, |
| 17 | + containerStyle, |
| 18 | + dateTitleStyle, |
| 19 | + largeTitleStyle, |
| 20 | + borderColor, |
| 21 | + backgroundColor, |
| 22 | + dateTitleFontSize, |
| 23 | + dateTitleFontColor, |
| 24 | + dateTitleFontWeight, |
| 25 | + largeTitleFontSize, |
| 26 | + largeTitleFontColor, |
| 27 | + largeTitleFontWeight |
| 28 | + } = props; |
8 | 29 | return ( |
9 | | - <View style={styles.container} {...props}> |
| 30 | + <View style={containerStyle || container(backgroundColor, borderColor)}> |
10 | 31 | <View> |
11 | | - <Text style={styles.date}>{dateTitle}</Text> |
12 | | - <Text style={styles.largeTitleStyle}>{largeTitle}</Text> |
| 32 | + <Text |
| 33 | + style={ |
| 34 | + dateTitleStyle || |
| 35 | + _dateTitleStyle( |
| 36 | + dateTitleFontColor, |
| 37 | + dateTitleFontSize, |
| 38 | + dateTitleFontWeight |
| 39 | + ) |
| 40 | + } |
| 41 | + > |
| 42 | + {dateTitle} |
| 43 | + </Text> |
| 44 | + <Text |
| 45 | + style={ |
| 46 | + largeTitleStyle || |
| 47 | + _largeTitleStyle( |
| 48 | + largeTitleFontColor, |
| 49 | + largeTitleFontSize, |
| 50 | + largeTitleFontWeight |
| 51 | + ) |
| 52 | + } |
| 53 | + > |
| 54 | + {largeTitle} |
| 55 | + </Text> |
13 | 56 | </View> |
14 | 57 | <TouchableOpacity style={styles.avatarContainerStyle} onPress={onPress}> |
15 | | - <Image style={styles.avatar} source={imageSource} {...props} /> |
| 58 | + <Image style={avatarStyle} source={imageSource} {...props} /> |
16 | 59 | </TouchableOpacity> |
17 | 60 | </View> |
18 | 61 | ); |
19 | 62 | }; |
20 | 63 |
|
21 | 64 | AppleHeader.propTypes = { |
22 | 65 | dateTitle: PropTypes.string, |
23 | | - largeTitle: PropTypes.string |
| 66 | + largeTitle: PropTypes.string, |
| 67 | + dateTitleFontSize: PropTypes.number, |
| 68 | + dateTitleFontColor: PropTypes.string, |
| 69 | + dateTitleFontWeight: PropTypes.string, |
| 70 | + backgroundColor: PropTypes.string, |
| 71 | + largeTitleFontSize: PropTypes.number, |
| 72 | + largeTitleFontColor: PropTypes.string, |
| 73 | + largeTitleFontWeight: PropTypes.string |
24 | 74 | }; |
25 | 75 |
|
26 | 76 | AppleHeader.defaultProps = { |
27 | | - dateTitle: "MONDAY, 27 NOVEMBER", |
| 77 | + dateTitleFontSize: 13, |
28 | 78 | largeTitle: "For You", |
| 79 | + dateTitleFontWeight: "600", |
| 80 | + largeTitleFontSize: 34, |
| 81 | + borderColor: "#EFEFF4", |
| 82 | + dateTitleFontColor: "#8E8E93", |
| 83 | + avatarStyle: styles.avatar, |
| 84 | + dateTitleStyle: styles.date, |
| 85 | + largeTitleFontWeight: "bold", |
| 86 | + backgroundColor: "transparent", |
| 87 | + dateTitle: "MONDAY, 27 NOVEMBER", |
| 88 | + containerStyle: styles.container, |
| 89 | + largeTitleStyle: styles.largeTitleStyle, |
29 | 90 | imageSource: require("../../../../assets/temp/joshua-rawson-harris-NdZtmw_jlMk-unsplash.jpg") |
30 | 91 | }; |
31 | 92 |
|
|
0 commit comments