@popp0102/nova 0.6.6 → 0.7.0
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.
- package/lib/components/Badge/config.js +21 -0
- package/lib/components/{Badge.js → Badge/index.js} +3 -22
- package/lib/components/Button/config.js +17 -8
- package/lib/components/Button/index.js +42 -49
- package/lib/components/Card/config.js +12 -0
- package/lib/components/{Card.js → Card/index.js} +2 -12
- package/lib/components/IconButton/config.js +10 -0
- package/lib/components/{IconButton.js → IconButton/index.js} +2 -10
- package/lib/components/Modal/config.js +42 -0
- package/lib/components/{Modal.js → Modal/index.js} +3 -45
- package/lib/components/Subtitle/config.js +13 -0
- package/lib/components/Subtitle/index.js +12 -0
- package/lib/components/Title/config.js +14 -0
- package/lib/components/Title/index.js +12 -0
- package/lib/components/animations/FadeView/config.js +6 -0
- package/lib/components/animations/FadeView/index.js +27 -0
- package/lib/components/animations/ShakeView/config.js +5 -0
- package/lib/components/animations/{ShakeView.js → ShakeView/index.js} +4 -3
- package/lib/components/animations/SlideView/config.js +8 -0
- package/lib/components/animations/{SlideView.js → SlideView/index.js} +8 -16
- package/package.json +3 -2
- package/lib/components/Subtitle.js +0 -23
- package/lib/components/Title.js +0 -24
- package/lib/components/animations/FadeView.js +0 -33
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const sizes = {
|
|
4
|
+
small: 12,
|
|
5
|
+
medium: 14,
|
|
6
|
+
large: 16,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const styles = StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
flexDirection: 'row',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
gap: 4,
|
|
14
|
+
padding: 8,
|
|
15
|
+
borderRadius: 24,
|
|
16
|
+
alignSelf: "flex-start",
|
|
17
|
+
},
|
|
18
|
+
text: {
|
|
19
|
+
fontWeight: '600',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { View, Text
|
|
1
|
+
import { View, Text } from 'react-native';
|
|
2
2
|
import { MaterialIcons } from '@expo/vector-icons';
|
|
3
|
-
|
|
4
|
-
const SIZES = {
|
|
5
|
-
small: 12,
|
|
6
|
-
medium: 14,
|
|
7
|
-
large: 16,
|
|
8
|
-
};
|
|
3
|
+
import { sizes, styles } from './config';
|
|
9
4
|
|
|
10
5
|
export default function Badge({
|
|
11
6
|
children,
|
|
@@ -17,7 +12,7 @@ export default function Badge({
|
|
|
17
12
|
size = 'large',
|
|
18
13
|
style
|
|
19
14
|
}) {
|
|
20
|
-
const fontSize =
|
|
15
|
+
const fontSize = sizes[size] || sizes.large;
|
|
21
16
|
|
|
22
17
|
return (
|
|
23
18
|
<View style={style}>
|
|
@@ -29,17 +24,3 @@ export default function Badge({
|
|
|
29
24
|
</View>
|
|
30
25
|
);
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
const styles = StyleSheet.create({
|
|
34
|
-
container: {
|
|
35
|
-
flexDirection: 'row',
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
gap: 4,
|
|
38
|
-
padding: 8,
|
|
39
|
-
borderRadius: 24,
|
|
40
|
-
alignSelf: "flex-start",
|
|
41
|
-
},
|
|
42
|
-
text: {
|
|
43
|
-
fontWeight: '600',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
@@ -19,26 +19,32 @@ export const sizes = {
|
|
|
19
19
|
tiny: {
|
|
20
20
|
fontSize: 12,
|
|
21
21
|
padding: 6,
|
|
22
|
+
fontWeight: '400',
|
|
22
23
|
},
|
|
23
24
|
small: {
|
|
24
25
|
fontSize: 14,
|
|
25
26
|
padding: 8,
|
|
27
|
+
fontWeight: '500',
|
|
26
28
|
},
|
|
27
29
|
medium: {
|
|
28
|
-
fontSize:
|
|
30
|
+
fontSize: 18,
|
|
29
31
|
padding: 12,
|
|
32
|
+
fontWeight: '600',
|
|
30
33
|
},
|
|
31
34
|
large: {
|
|
32
|
-
fontSize:
|
|
35
|
+
fontSize: 22,
|
|
33
36
|
padding: 16,
|
|
37
|
+
fontWeight: '700',
|
|
34
38
|
},
|
|
35
39
|
xlarge: {
|
|
36
|
-
fontSize:
|
|
40
|
+
fontSize: 26,
|
|
37
41
|
padding: 20,
|
|
42
|
+
fontWeight: '800',
|
|
38
43
|
},
|
|
39
44
|
xxlarge: {
|
|
40
|
-
fontSize:
|
|
45
|
+
fontSize: 30,
|
|
41
46
|
padding: 24,
|
|
47
|
+
fontWeight: '900',
|
|
42
48
|
},
|
|
43
49
|
};
|
|
44
50
|
|
|
@@ -46,10 +52,13 @@ export const styles = StyleSheet.create({
|
|
|
46
52
|
button: {
|
|
47
53
|
padding: 8,
|
|
48
54
|
borderRadius: 8,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
borderWidth: 2,
|
|
56
|
+
borderColor: 'rgba(0, 0, 0, 0.3)',
|
|
57
|
+
shadowColor: '#000',
|
|
58
|
+
shadowOffset: { width: 0, height: 4 },
|
|
59
|
+
shadowOpacity: 0.3,
|
|
60
|
+
shadowRadius: 6,
|
|
61
|
+
elevation: 8,
|
|
53
62
|
},
|
|
54
63
|
buttonContent: {
|
|
55
64
|
flexDirection: 'row',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { View, Text, Pressable } from 'react-native';
|
|
2
|
+
import { LinearGradient } from 'expo-linear-gradient';
|
|
2
3
|
import { MaterialIcons } from '@expo/vector-icons';
|
|
3
4
|
import { colors, sizes, styles } from './config';
|
|
4
5
|
|
|
@@ -10,70 +11,62 @@ export default function Button({
|
|
|
10
11
|
style,
|
|
11
12
|
onPress,
|
|
12
13
|
children,
|
|
13
|
-
icon
|
|
14
|
-
iconPosition,
|
|
15
|
-
iconColor
|
|
14
|
+
icon
|
|
16
15
|
}) {
|
|
17
16
|
const buttonColors = colors[type];
|
|
18
17
|
const buttonSizes = sizes[size];
|
|
19
|
-
const
|
|
18
|
+
const isGradient = Array.isArray(color);
|
|
19
|
+
const backgroundColor = isGradient ? null : (color || buttonColors.background);
|
|
20
20
|
const finalTextColor = textColor || buttonColors.text;
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
|
|
22
|
+
const iconName = icon?.name;
|
|
23
|
+
const iconPosition = icon?.position;
|
|
24
|
+
const iconColor = icon?.color || finalTextColor;
|
|
23
25
|
|
|
24
26
|
if (iconPosition && !['left', 'right', 'top'].includes(iconPosition)) {
|
|
25
|
-
throw new Error(`Invalid
|
|
27
|
+
throw new Error(`Invalid icon.position: "${iconPosition}". Must be "left", "right", or "top".`);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
const isVerticalLayout = iconPosition === 'top';
|
|
31
|
+
const baseIconSize = buttonSizes.fontSize * 1.4;
|
|
29
32
|
const verticalIconSize = buttonSizes.fontSize * 2.5;
|
|
33
|
+
const iconSize = isVerticalLayout ? verticalIconSize : baseIconSize;
|
|
34
|
+
|
|
35
|
+
const textElement = (
|
|
36
|
+
<Text
|
|
37
|
+
style={[styles.text, { color: finalTextColor, fontSize: buttonSizes.fontSize, fontWeight: buttonSizes.fontWeight }]}
|
|
38
|
+
numberOfLines={1}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</Text>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const iconElement = iconName && (
|
|
45
|
+
<MaterialIcons name={iconName} size={iconSize} color={iconColor} />
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const content = (
|
|
49
|
+
<View style={[styles.buttonContent, isVerticalLayout && styles.verticalContent]}>
|
|
50
|
+
{iconName && (iconPosition === 'left' || iconPosition === 'top') && iconElement}
|
|
51
|
+
{textElement}
|
|
52
|
+
{iconName && iconPosition === 'right' && iconElement}
|
|
53
|
+
</View>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const backgroundStyle = isGradient
|
|
57
|
+
? { overflow: 'hidden', padding: 0 }
|
|
58
|
+
: { backgroundColor, padding: buttonSizes.padding };
|
|
30
59
|
|
|
31
60
|
return (
|
|
32
61
|
<Pressable
|
|
33
62
|
onPress={onPress}
|
|
34
|
-
style={({ pressed }) => [
|
|
35
|
-
styles.button,
|
|
36
|
-
{
|
|
37
|
-
backgroundColor: backgroundColor,
|
|
38
|
-
padding: buttonSizes.padding,
|
|
39
|
-
},
|
|
40
|
-
pressed && styles.pressed,
|
|
41
|
-
style,
|
|
42
|
-
]}
|
|
63
|
+
style={({ pressed }) => [styles.button, backgroundStyle, pressed && styles.pressed, style]}
|
|
43
64
|
>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<>
|
|
50
|
-
{icon && (
|
|
51
|
-
<MaterialIcons name={icon} size={verticalIconSize} color={finalIconColor} />
|
|
52
|
-
)}
|
|
53
|
-
<Text
|
|
54
|
-
style={[styles.text, { color: finalTextColor, fontSize: buttonSizes.fontSize }]}
|
|
55
|
-
numberOfLines={1}
|
|
56
|
-
>
|
|
57
|
-
{children}
|
|
58
|
-
</Text>
|
|
59
|
-
</>
|
|
60
|
-
) : (
|
|
61
|
-
<>
|
|
62
|
-
{icon && iconPosition === 'left' && (
|
|
63
|
-
<MaterialIcons name={icon} size={iconSize} color={finalIconColor} />
|
|
64
|
-
)}
|
|
65
|
-
<Text
|
|
66
|
-
style={[styles.text, { color: finalTextColor, fontSize: buttonSizes.fontSize }]}
|
|
67
|
-
numberOfLines={1}
|
|
68
|
-
>
|
|
69
|
-
{children}
|
|
70
|
-
</Text>
|
|
71
|
-
{icon && iconPosition === 'right' && (
|
|
72
|
-
<MaterialIcons name={icon} size={iconSize} color={finalIconColor} />
|
|
73
|
-
)}
|
|
74
|
-
</>
|
|
75
|
-
)}
|
|
76
|
-
</View>
|
|
65
|
+
{isGradient ? (
|
|
66
|
+
<LinearGradient colors={color} style={{ padding: buttonSizes.padding }}>
|
|
67
|
+
{content}
|
|
68
|
+
</LinearGradient>
|
|
69
|
+
) : content}
|
|
77
70
|
</Pressable>
|
|
78
71
|
);
|
|
79
72
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { View, Pressable
|
|
1
|
+
import { View, Pressable } from "react-native";
|
|
2
|
+
import { styles } from './config';
|
|
2
3
|
|
|
3
4
|
export default function Card({ children, onPress, style }) {
|
|
4
5
|
const cardContent = (
|
|
@@ -20,14 +21,3 @@ export default function Card({ children, onPress, style }) {
|
|
|
20
21
|
|
|
21
22
|
return cardContent;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
const styles = StyleSheet.create({
|
|
25
|
-
card: {
|
|
26
|
-
backgroundColor: 'white',
|
|
27
|
-
borderRadius: 16,
|
|
28
|
-
padding: 16,
|
|
29
|
-
},
|
|
30
|
-
cardPressed: {
|
|
31
|
-
opacity: 0.5,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Pressable
|
|
1
|
+
import { Pressable } from "react-native";
|
|
2
2
|
import { MaterialIcons } from '@expo/vector-icons';
|
|
3
|
+
import { styles } from './config';
|
|
3
4
|
|
|
4
5
|
export default function IconButton({ name, size = 24, color = 'black', onPress }) {
|
|
5
6
|
return (
|
|
@@ -14,12 +15,3 @@ export default function IconButton({ name, size = 24, color = 'black', onPress }
|
|
|
14
15
|
</Pressable>
|
|
15
16
|
);
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
const styles = StyleSheet.create({
|
|
19
|
-
button: {
|
|
20
|
-
padding: 4,
|
|
21
|
-
},
|
|
22
|
-
pressed: {
|
|
23
|
-
opacity: 0.5,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
backdrop: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
justifyContent: "center",
|
|
8
|
+
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
9
|
+
},
|
|
10
|
+
container: {
|
|
11
|
+
width: "75%",
|
|
12
|
+
padding: 8,
|
|
13
|
+
borderRadius: 24,
|
|
14
|
+
backgroundColor: "#CCCCCC",
|
|
15
|
+
},
|
|
16
|
+
header: {
|
|
17
|
+
width: "100%",
|
|
18
|
+
paddingTop: 16,
|
|
19
|
+
paddingHorizontal: 16,
|
|
20
|
+
},
|
|
21
|
+
title: {
|
|
22
|
+
marginTop: 16,
|
|
23
|
+
fontSize: 24,
|
|
24
|
+
fontWeight: "bold",
|
|
25
|
+
color: "black",
|
|
26
|
+
},
|
|
27
|
+
body: {
|
|
28
|
+
paddingHorizontal: 16,
|
|
29
|
+
paddingVertical: 24,
|
|
30
|
+
gap: 8,
|
|
31
|
+
},
|
|
32
|
+
footer: {
|
|
33
|
+
flexDirection: "row",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "flex-end",
|
|
36
|
+
gap: 8,
|
|
37
|
+
paddingVertical: 8,
|
|
38
|
+
},
|
|
39
|
+
button: {
|
|
40
|
+
flex: 0.25,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { View, Text, Modal as RNModal
|
|
1
|
+
import { View, Text, Modal as RNModal } from "react-native";
|
|
2
2
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
3
|
-
|
|
4
|
-
import
|
|
3
|
+
import Button from "../Button";
|
|
4
|
+
import { styles } from './config';
|
|
5
5
|
|
|
6
6
|
export default function Modal({ visible, title, onConfirm, onClose, children, includeFooter = true }) {
|
|
7
7
|
return (
|
|
@@ -25,45 +25,3 @@ export default function Modal({ visible, title, onConfirm, onClose, children, in
|
|
|
25
25
|
</RNModal>
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
const styles = StyleSheet.create({
|
|
30
|
-
backdrop: {
|
|
31
|
-
flex: 1,
|
|
32
|
-
alignItems: "center",
|
|
33
|
-
justifyContent: "center",
|
|
34
|
-
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
35
|
-
},
|
|
36
|
-
container: {
|
|
37
|
-
width: "75%",
|
|
38
|
-
padding: 8,
|
|
39
|
-
borderRadius: 24,
|
|
40
|
-
backgroundColor: "#CCCCCC",
|
|
41
|
-
},
|
|
42
|
-
header: {
|
|
43
|
-
width: "100%",
|
|
44
|
-
paddingTop: 16,
|
|
45
|
-
paddingHorizontal: 16,
|
|
46
|
-
},
|
|
47
|
-
title: {
|
|
48
|
-
marginTop: 16,
|
|
49
|
-
fontSize: 24,
|
|
50
|
-
fontWeight: "bold",
|
|
51
|
-
color: "black",
|
|
52
|
-
},
|
|
53
|
-
body: {
|
|
54
|
-
paddingHorizontal: 16,
|
|
55
|
-
paddingVertical: 24,
|
|
56
|
-
gap: 8,
|
|
57
|
-
},
|
|
58
|
-
footer: {
|
|
59
|
-
flexDirection: "row",
|
|
60
|
-
alignItems: "center",
|
|
61
|
-
justifyContent: "flex-end",
|
|
62
|
-
gap: 8,
|
|
63
|
-
paddingVertical: 8,
|
|
64
|
-
},
|
|
65
|
-
button: {
|
|
66
|
-
flex: 0.25,
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Text } from "react-native";
|
|
2
|
+
import { sizes, styles } from './config';
|
|
3
|
+
|
|
4
|
+
export default function Subtitle({ children, color = '#777', size = 'medium' }) {
|
|
5
|
+
const fontSize = sizes[size] || sizes.medium;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Text style={[styles.subtitle, { color, fontSize }]}>
|
|
9
|
+
{children}
|
|
10
|
+
</Text>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Text } from "react-native";
|
|
2
|
+
import { sizes, styles } from './config';
|
|
3
|
+
|
|
4
|
+
export default function Title({ children, color = 'black', size = 'medium' }) {
|
|
5
|
+
const fontSize = sizes[size] || sizes.medium;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Text style={[styles.title, { color, fontSize }]}>
|
|
9
|
+
{children}
|
|
10
|
+
</Text>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { directions, validDirections } from './config';
|
|
4
|
+
|
|
5
|
+
export default function FadeView({ children, direction = directions.IN, duration = 1000, style }) {
|
|
6
|
+
if (!validDirections.includes(direction)) {
|
|
7
|
+
throw new Error(`FadeView: direction must be one of ${validDirections.join(', ')}. Got: ${direction}`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const fadeAnimationValue = useRef(
|
|
11
|
+
new Animated.Value(direction === directions.IN ? 0 : 1)
|
|
12
|
+
).current;
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
Animated.timing(fadeAnimationValue, {
|
|
16
|
+
toValue: direction === directions.IN ? 1 : 0,
|
|
17
|
+
duration,
|
|
18
|
+
useNativeDriver: true
|
|
19
|
+
}).start();
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Animated.View style={[style, { opacity: fadeAnimationValue }]}>
|
|
24
|
+
{children}
|
|
25
|
+
</Animated.View>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
import { Animated } from 'react-native';
|
|
3
|
+
import { defaults } from './config';
|
|
3
4
|
|
|
4
5
|
export default function ShakeView({
|
|
5
6
|
shake,
|
|
6
7
|
children,
|
|
7
8
|
style,
|
|
8
|
-
duration =
|
|
9
|
-
distance =
|
|
10
|
-
intensity =
|
|
9
|
+
duration = defaults.duration,
|
|
10
|
+
distance = defaults.distance,
|
|
11
|
+
intensity = defaults.intensity
|
|
11
12
|
}) {
|
|
12
13
|
const shakeAnim = useRef(new Animated.Value(0)).current;
|
|
13
14
|
|
|
@@ -1,36 +1,28 @@
|
|
|
1
1
|
import { Animated } from 'react-native';
|
|
2
2
|
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { directions, validDirections } from './config';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
UP: 'up',
|
|
8
|
-
DOWN: 'down',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const VALID_DIRECTIONS = Object.values(DIRECTIONS);
|
|
12
|
-
|
|
13
|
-
export default function SlideView({ children, direction = DIRECTIONS.LEFT, duration = 1000, style }) {
|
|
14
|
-
if (!VALID_DIRECTIONS.includes(direction)) {
|
|
15
|
-
throw new Error(`SlideView: direction must be one of ${VALID_DIRECTIONS.join(', ')}. Got: ${direction}`);
|
|
5
|
+
export default function SlideView({ children, direction = directions.LEFT, duration = 1000, style }) {
|
|
6
|
+
if (!validDirections.includes(direction)) {
|
|
7
|
+
throw new Error(`SlideView: direction must be one of ${validDirections.join(', ')}. Got: ${direction}`);
|
|
16
8
|
}
|
|
17
9
|
let initialValue = 300;
|
|
18
10
|
let transformProperty = 'translateX';
|
|
19
11
|
|
|
20
12
|
switch(direction) {
|
|
21
|
-
case
|
|
13
|
+
case directions.LEFT:
|
|
22
14
|
initialValue = 300;
|
|
23
15
|
transformProperty = 'translateX';
|
|
24
16
|
break;
|
|
25
|
-
case
|
|
17
|
+
case directions.RIGHT:
|
|
26
18
|
initialValue = -300;
|
|
27
19
|
transformProperty = 'translateX';
|
|
28
20
|
break;
|
|
29
|
-
case
|
|
21
|
+
case directions.UP:
|
|
30
22
|
initialValue = 300;
|
|
31
23
|
transformProperty = 'translateY';
|
|
32
24
|
break;
|
|
33
|
-
case
|
|
25
|
+
case directions.DOWN:
|
|
34
26
|
initialValue = -300;
|
|
35
27
|
transformProperty = 'translateY';
|
|
36
28
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popp0102/nova",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "React Native component library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@expo/vector-icons": ">=14.0.0",
|
|
34
|
+
"expo-linear-gradient": ">=14.0.0",
|
|
34
35
|
"react": ">=18.0.0",
|
|
35
36
|
"react-native": ">=0.70.0",
|
|
36
37
|
"react-native-safe-area-context": ">=4.0.0"
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"@babel/preset-react": "^7.24.0",
|
|
43
44
|
"@testing-library/react-native": "^12.4.3",
|
|
44
45
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
45
|
-
"eslint": "^8.57.
|
|
46
|
+
"eslint": "^8.57.1",
|
|
46
47
|
"eslint-plugin-react": "^7.37.5",
|
|
47
48
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
48
49
|
"jest": "^30.2.0",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Text, StyleSheet } from "react-native";
|
|
2
|
-
|
|
3
|
-
const SIZES = {
|
|
4
|
-
small: 12,
|
|
5
|
-
medium: 14,
|
|
6
|
-
large: 16,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default function Subtitle({ children, color = '#777', size = 'medium' }) {
|
|
10
|
-
const fontSize = SIZES[size] || SIZES.medium;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<Text style={[styles.subtitle, { color, fontSize }]}>
|
|
14
|
-
{children}
|
|
15
|
-
</Text>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const styles = StyleSheet.create({
|
|
20
|
-
subtitle: {
|
|
21
|
-
fontStyle: 'italic',
|
|
22
|
-
},
|
|
23
|
-
});
|
package/lib/components/Title.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Text, StyleSheet } from "react-native";
|
|
2
|
-
|
|
3
|
-
const SIZES = {
|
|
4
|
-
tiny: 16,
|
|
5
|
-
small: 20,
|
|
6
|
-
medium: 24,
|
|
7
|
-
large: 28,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default function Title({ children, color = 'black', size = 'medium' }) {
|
|
11
|
-
const fontSize = SIZES[size] || SIZES.medium;
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Text style={[styles.title, { color, fontSize }]}>
|
|
15
|
-
{children}
|
|
16
|
-
</Text>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const styles = StyleSheet.create({
|
|
21
|
-
title: {
|
|
22
|
-
fontWeight: 'bold',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Animated } from 'react-native';
|
|
2
|
-
import { useRef, useEffect } from 'react';
|
|
3
|
-
|
|
4
|
-
const DIRECTIONS = {
|
|
5
|
-
IN: 'in',
|
|
6
|
-
OUT: 'out'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const VALID_DIRECTIONS = Object.values(DIRECTIONS);
|
|
10
|
-
|
|
11
|
-
export default function FadeView({ children, direction = DIRECTIONS.IN, duration = 1000, style }) {
|
|
12
|
-
if (!VALID_DIRECTIONS.includes(direction)) {
|
|
13
|
-
throw new Error(`FadeView: direction must be one of ${VALID_DIRECTIONS.join(', ')}. Got: ${direction}`);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const fadeAnimationValue = useRef(
|
|
17
|
-
new Animated.Value(direction === DIRECTIONS.IN ? 0 : 1)
|
|
18
|
-
).current;
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
Animated.timing(fadeAnimationValue, {
|
|
22
|
-
toValue: direction === DIRECTIONS.IN ? 1 : 0,
|
|
23
|
-
duration,
|
|
24
|
-
useNativeDriver: true
|
|
25
|
-
}).start();
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Animated.View style={[style, { opacity: fadeAnimationValue }]}>
|
|
30
|
-
{children}
|
|
31
|
-
</Animated.View>
|
|
32
|
-
);
|
|
33
|
-
}
|