|
| 1 | +import React from "react"; |
| 2 | +import PropTypes from "prop-types"; |
| 3 | +import { Text, View, Image, TouchableOpacity } from "react-native"; |
| 4 | +import styles, { |
| 5 | + container, |
| 6 | + _dateTitleStyle, |
| 7 | + _largeTitleStyle |
| 8 | +} from "./AppleHeader.style"; |
| 9 | + |
| 10 | +const AppleHeader = 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; |
| 29 | + return ( |
| 30 | + <View style={containerStyle || container(backgroundColor, borderColor)}> |
| 31 | + <View> |
| 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> |
| 56 | + </View> |
| 57 | + <TouchableOpacity style={styles.avatarContainerStyle} onPress={onPress}> |
| 58 | + <Image style={avatarStyle} source={imageSource} {...props} /> |
| 59 | + </TouchableOpacity> |
| 60 | + </View> |
| 61 | + ); |
| 62 | +}; |
| 63 | + |
| 64 | +AppleHeader.propTypes = { |
| 65 | + dateTitle: 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 |
| 74 | +}; |
| 75 | + |
| 76 | +AppleHeader.defaultProps = { |
| 77 | + dateTitleFontSize: 13, |
| 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 |
| 90 | +}; |
| 91 | + |
| 92 | +export default AppleHeader; |
0 commit comments