@popp0102/nova 0.2.2 → 0.2.4

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.
@@ -6,15 +6,16 @@ export default function Badge({
6
6
  leftIcon,
7
7
  rightIcon,
8
8
  iconSize = 20,
9
- iconColor = 'white',
9
+ color = 'white',
10
+ backgroundColor = 'blue',
10
11
  style
11
12
  }) {
12
13
  return (
13
14
  <View style={style}>
14
- <View style={styles.container}>
15
- {leftIcon && <MaterialIcons name={leftIcon} size={iconSize} color={iconColor} />}
16
- <Text style={styles.text}>{children}</Text>
17
- {rightIcon && <MaterialIcons name={rightIcon} size={iconSize} color={iconColor} />}
15
+ <View style={[styles.container, { backgroundColor }]}>
16
+ {leftIcon && <MaterialIcons name={leftIcon} size={iconSize} color={color} />}
17
+ <Text style={[styles.text, { color }]}>{children}</Text>
18
+ {rightIcon && <MaterialIcons name={rightIcon} size={iconSize} color={color} />}
18
19
  </View>
19
20
  </View>
20
21
  );
@@ -27,11 +28,9 @@ const styles = StyleSheet.create({
27
28
  gap: 4,
28
29
  padding: 8,
29
30
  borderRadius: 24,
30
- backgroundColor: "blue",
31
31
  alignSelf: "flex-start",
32
32
  },
33
33
  text: {
34
- color: "white",
35
34
  fontSize: 16,
36
35
  },
37
36
  });
@@ -1,4 +1,5 @@
1
1
  import { View, Text, Pressable, StyleSheet } from 'react-native';
2
+ import { MaterialIcons } from '@expo/vector-icons';
2
3
  import { useDeviceSize } from '../utils/deviceSize';
3
4
 
4
5
  const colors = {
@@ -31,10 +32,20 @@ const responsiveSizes = {
31
32
  },
32
33
  };
33
34
 
34
- export default function Button({ type = 'primary', style, onPress, children }) {
35
+ export default function Button({
36
+ type = 'primary',
37
+ style,
38
+ onPress,
39
+ children,
40
+ leftIcon,
41
+ rightIcon,
42
+ iconColor
43
+ }) {
35
44
  const buttonColors = colors[type];
36
45
  const deviceSize = useDeviceSize();
37
46
  const sizes = responsiveSizes[deviceSize];
47
+ const iconSize = sizes.fontSize * 1.4;
48
+ const finalIconColor = iconColor || buttonColors.text;
38
49
 
39
50
  return (
40
51
  <View style={[style]}>
@@ -49,12 +60,20 @@ export default function Button({ type = 'primary', style, onPress, children }) {
49
60
  pressed && styles.pressed,
50
61
  ]}
51
62
  >
52
- <Text
53
- style={[styles.text, { color: buttonColors.text, fontSize: sizes.fontSize }]}
54
- numberOfLines={1}
55
- >
56
- {children}
57
- </Text>
63
+ <View style={styles.buttonContent}>
64
+ {leftIcon && (
65
+ <MaterialIcons name={leftIcon} size={iconSize} color={finalIconColor} />
66
+ )}
67
+ <Text
68
+ style={[styles.text, { color: buttonColors.text, fontSize: sizes.fontSize }]}
69
+ numberOfLines={1}
70
+ >
71
+ {children}
72
+ </Text>
73
+ {rightIcon && (
74
+ <MaterialIcons name={rightIcon} size={iconSize} color={finalIconColor} />
75
+ )}
76
+ </View>
58
77
  </Pressable>
59
78
  </View>
60
79
  );
@@ -69,6 +88,12 @@ const styles = StyleSheet.create({
69
88
  shadowRadius: 1.0,
70
89
  elevation: 2,
71
90
  },
91
+ buttonContent: {
92
+ flexDirection: 'row',
93
+ alignItems: 'center',
94
+ justifyContent: 'center',
95
+ gap: 8,
96
+ },
72
97
  text: {
73
98
  textAlign: 'center',
74
99
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popp0102/nova",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "React Native component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",