@umituz/react-native-design-system 2.4.4 → 2.4.5
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/package.json +1 -1
- package/src/atoms/AtomicCard.tsx +50 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.5",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/atoms/AtomicCard.tsx
CHANGED
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AtomicCard Component
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* A simple, styled card container component
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
View,
|
|
10
|
+
Pressable,
|
|
11
|
+
StyleSheet,
|
|
12
|
+
type ViewStyle,
|
|
13
|
+
type StyleProp,
|
|
14
|
+
type GestureResponderEvent,
|
|
15
|
+
} from 'react-native';
|
|
9
16
|
import { useAppDesignTokens } from '../theme';
|
|
10
17
|
|
|
11
18
|
export type AtomicCardVariant = 'elevated' | 'outlined' | 'filled';
|
|
12
19
|
export type AtomicCardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
13
20
|
|
|
14
21
|
export interface AtomicCardProps {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
variant?: AtomicCardVariant;
|
|
24
|
+
padding?: AtomicCardPadding;
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
testID?: string;
|
|
27
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
28
|
+
disabled?: boolean;
|
|
20
29
|
}
|
|
21
30
|
|
|
22
31
|
export const AtomicCard: React.FC<AtomicCardProps> = ({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
children,
|
|
33
|
+
variant = 'elevated',
|
|
34
|
+
padding = 'md',
|
|
35
|
+
style,
|
|
36
|
+
testID,
|
|
37
|
+
onPress,
|
|
38
|
+
disabled,
|
|
28
39
|
}) => {
|
|
29
40
|
const tokens = useAppDesignTokens();
|
|
30
41
|
|
|
@@ -58,24 +69,36 @@ export const AtomicCard: React.FC<AtomicCardProps> = ({
|
|
|
58
69
|
}
|
|
59
70
|
};
|
|
60
71
|
|
|
72
|
+
const cardStyle = [
|
|
73
|
+
styles.card,
|
|
74
|
+
{ borderRadius: tokens.borders.radius.md },
|
|
75
|
+
{ padding: paddingValues[padding] },
|
|
76
|
+
getVariantStyle(),
|
|
77
|
+
style,
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
if (onPress) {
|
|
61
81
|
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
testID={testID}
|
|
71
|
-
>
|
|
72
|
-
{children}
|
|
73
|
-
</View>
|
|
82
|
+
<Pressable
|
|
83
|
+
style={cardStyle}
|
|
84
|
+
testID={testID}
|
|
85
|
+
onPress={onPress}
|
|
86
|
+
disabled={disabled}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
</Pressable>
|
|
74
90
|
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<View style={cardStyle} testID={testID}>
|
|
95
|
+
{children}
|
|
96
|
+
</View>
|
|
97
|
+
);
|
|
75
98
|
};
|
|
76
99
|
|
|
77
100
|
const styles = StyleSheet.create({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
101
|
+
card: {
|
|
102
|
+
overflow: 'hidden',
|
|
103
|
+
},
|
|
81
104
|
});
|