|
| 1 | +import React from 'react'; |
| 2 | +import { Text, View, StyleSheet, Link } from '@react-pdf/renderer'; |
| 3 | +import { tokens } from '@template-core/design-tokens'; |
| 4 | +import type { CoverLetterSchema } from '@types'; |
| 5 | + |
| 6 | +const { colors, spacing } = tokens.classic; |
| 7 | + |
| 8 | +const styles = StyleSheet.create({ |
| 9 | + headerContainer: { |
| 10 | + flexDirection: 'row', |
| 11 | + justifyContent: 'space-between', |
| 12 | + alignItems: 'flex-start', |
| 13 | + marginBottom: spacing.pagePadding / 2, // Reduced spacing to account for separator |
| 14 | + width: '100%', |
| 15 | + }, |
| 16 | + separatorLine: { |
| 17 | + borderBottom: `1px solid ${colors.separatorGray}`, |
| 18 | + marginBottom: spacing.pagePadding / 2, // Space after separator |
| 19 | + width: '100%', |
| 20 | + }, |
| 21 | + companyArea: { |
| 22 | + flexDirection: 'column', |
| 23 | + alignItems: 'flex-start', |
| 24 | + }, |
| 25 | + companyName: { |
| 26 | + fontSize: 9, |
| 27 | + fontFamily: 'Lato Bold', |
| 28 | + color: colors.darkGray, |
| 29 | + }, |
| 30 | + contactArea: { |
| 31 | + flexDirection: 'column', |
| 32 | + alignItems: 'flex-end', |
| 33 | + textAlign: 'right', |
| 34 | + }, |
| 35 | + contactName: { |
| 36 | + fontSize: 9, |
| 37 | + fontFamily: 'Lato', |
| 38 | + lineHeight: 1.44, |
| 39 | + color: colors.darkGray, |
| 40 | + }, |
| 41 | + contactDetails: { |
| 42 | + fontFamily: 'Lato', |
| 43 | + fontSize: 9, |
| 44 | + lineHeight: 1.44, |
| 45 | + color: colors.mediumGray, |
| 46 | + }, |
| 47 | +}); |
| 48 | + |
| 49 | +const Header = ({ data }: { data: CoverLetterSchema }) => ( |
| 50 | + <View> |
| 51 | + <View style={styles.headerContainer}> |
| 52 | + <View style={styles.companyArea}> |
| 53 | + <Text style={styles.companyName}>{data.company}</Text> |
| 54 | + </View> |
| 55 | + |
| 56 | + <View style={styles.contactArea}> |
| 57 | + <Text style={styles.contactName}>{data.personal_info.name}</Text> |
| 58 | + <Text style={styles.contactDetails}>{data.personal_info.address}</Text> |
| 59 | + <Text style={styles.contactDetails}> |
| 60 | + <Link style={styles.contactDetails} src={data.personal_info.email}> |
| 61 | + {data.personal_info.email} |
| 62 | + </Link> |
| 63 | + </Text> |
| 64 | + <Text style={styles.contactDetails}>{data.personal_info.phone}</Text> |
| 65 | + </View> |
| 66 | + </View> |
| 67 | + {/* Separator line to match mockup */} |
| 68 | + <View style={styles.separatorLine} /> |
| 69 | + </View> |
| 70 | +); |
| 71 | + |
| 72 | +export default Header; |
0 commit comments