@popp0102/nova 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { View, Pressable } from 'react-native';
|
|
2
2
|
import { MaterialIcons } from '@expo/vector-icons';
|
|
3
3
|
import Heading from '../Heading';
|
|
4
|
+
import { useDeviceSize } from '../../utils/deviceSize';
|
|
4
5
|
import { styles } from './config';
|
|
5
6
|
|
|
6
7
|
export default function ScreenHeader({
|
|
@@ -13,30 +14,29 @@ export default function ScreenHeader({
|
|
|
13
14
|
subtitleColor = "#2C1810",
|
|
14
15
|
backIconColor = "#4A2C0A"
|
|
15
16
|
}) {
|
|
17
|
+
const deviceSize = useDeviceSize();
|
|
18
|
+
const titleSize = deviceSize === 'small' ? 'h3' : 'h2';
|
|
19
|
+
const subtitleSize = deviceSize === 'small' ? 'h6' : 'h5';
|
|
16
20
|
return (
|
|
17
21
|
<View style={styles.header}>
|
|
18
22
|
<View style={styles.topRow}>
|
|
19
|
-
{onBack
|
|
23
|
+
{onBack && (
|
|
20
24
|
<Pressable onPress={onBack} style={styles.backButton} testID="screen-header-back-button">
|
|
21
25
|
<MaterialIcons name="arrow-back" size={32} color={backIconColor} />
|
|
22
26
|
</Pressable>
|
|
23
|
-
) : (
|
|
24
|
-
<View style={styles.backButton} />
|
|
25
27
|
)}
|
|
26
28
|
<View style={styles.titleContainer}>
|
|
27
|
-
<Heading size=
|
|
29
|
+
<Heading size={titleSize} fontFamily={titleFontFamily} color={titleColor}>{title}</Heading>
|
|
28
30
|
</View>
|
|
29
|
-
{rightContent
|
|
31
|
+
{rightContent && (
|
|
30
32
|
<View style={styles.rightContent}>
|
|
31
33
|
{rightContent}
|
|
32
34
|
</View>
|
|
33
|
-
) : (
|
|
34
|
-
<View style={styles.rightContent} />
|
|
35
35
|
)}
|
|
36
36
|
</View>
|
|
37
37
|
{subtitle && (
|
|
38
38
|
<View style={styles.subtitleRow}>
|
|
39
|
-
<Heading size=
|
|
39
|
+
<Heading size={subtitleSize} color={subtitleColor}>{subtitle}</Heading>
|
|
40
40
|
</View>
|
|
41
41
|
)}
|
|
42
42
|
</View>
|