cdslibrary 1.2.49 → 1.2.50
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.
|
@@ -19,11 +19,11 @@ export const CDSImageButton = ({ object, isActive, onPress }) => { // 👈 Añad
|
|
|
19
19
|
? theme.surface.neutral.primaryVariant // Color cuando está presionado
|
|
20
20
|
: theme.surface.neutral.primary,
|
|
21
21
|
gap: theme.space.sm,
|
|
22
|
-
padding: theme.space.
|
|
22
|
+
padding: theme.space.sm,
|
|
23
23
|
// borderColor: isActive
|
|
24
24
|
// ? theme.outline.neutral.primary // Borde de color de marca si está activo
|
|
25
25
|
// : theme.outline.neutral.primary,
|
|
26
|
-
borderRadius: theme.radius.
|
|
26
|
+
borderRadius: theme.radius.md,
|
|
27
27
|
// Si está activo, quitamos la sombra o usamos una más pequeña (md)
|
|
28
28
|
...(!isActive && theme.shadows.lg),
|
|
29
29
|
// Si quieres que se vea "hundido", podrías bajar la escala
|
|
@@ -38,6 +38,7 @@ export const CDSImageButton = ({ object, isActive, onPress }) => { // 👈 Añad
|
|
|
38
38
|
flexGrow: 1,
|
|
39
39
|
width: "100%",
|
|
40
40
|
height: 80,
|
|
41
|
+
borderRadius: theme.radius.sm,
|
|
41
42
|
}}
|
|
42
43
|
/>
|
|
43
44
|
<Text style={isActive ? theme.typography.semiBold.sm : theme.typography.regular.sm }>
|
|
@@ -3,8 +3,9 @@ import { View, Animated, StyleSheet, ScrollView } from 'react-native';
|
|
|
3
3
|
import { CDSImageButton } from './CDSImageButton';
|
|
4
4
|
import { useTheme } from "../context/CDSThemeContext";
|
|
5
5
|
|
|
6
|
-
export const CDSImageButtonGroup = ({ array, onSelect }) => {
|
|
6
|
+
export const CDSImageButtonGroup = ({ array, onSelect, isCentered }) => {
|
|
7
7
|
const { theme } = useTheme();
|
|
8
|
+
const isMobile = theme.isMobile
|
|
8
9
|
const [selectedId, setSelectedId] = useState(null);
|
|
9
10
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
10
11
|
|
|
@@ -31,10 +32,6 @@ export const CDSImageButtonGroup = ({ array, onSelect }) => {
|
|
|
31
32
|
outputRange: [0, 250]
|
|
32
33
|
}),
|
|
33
34
|
opacity: animatedValue,
|
|
34
|
-
marginTop: animatedValue.interpolate({
|
|
35
|
-
inputRange: [0, 1],
|
|
36
|
-
outputRange: [0, theme.space.md]
|
|
37
|
-
})
|
|
38
35
|
};
|
|
39
36
|
|
|
40
37
|
return (
|
|
@@ -45,14 +42,15 @@ export const CDSImageButtonGroup = ({ array, onSelect }) => {
|
|
|
45
42
|
<ScrollView
|
|
46
43
|
horizontal={true}
|
|
47
44
|
showsHorizontalScrollIndicator={false}
|
|
48
|
-
// IMPORTANTE: overflow visible para que no corte sombras,
|
|
49
|
-
// pero necesitamos que el ScrollView sepa su límite
|
|
50
45
|
style={styles.scrollView}
|
|
51
46
|
contentContainerStyle={[
|
|
52
47
|
styles.scrollContent,
|
|
53
48
|
{
|
|
49
|
+
justifyContent: (isCentered ? 'center' : 'flex-start'),
|
|
50
|
+
|
|
54
51
|
gap: theme.space.sm,
|
|
55
|
-
|
|
52
|
+
padding: theme.space.md,
|
|
53
|
+
width: (isMobile ? 'auto' : '100%')
|
|
56
54
|
}
|
|
57
55
|
]}
|
|
58
56
|
>
|
|
@@ -72,13 +70,11 @@ export const CDSImageButtonGroup = ({ array, onSelect }) => {
|
|
|
72
70
|
const styles = StyleSheet.create({
|
|
73
71
|
scrollView: {
|
|
74
72
|
width: '100%',
|
|
75
|
-
overflow: 'visible'
|
|
73
|
+
overflow: 'visible',
|
|
76
74
|
},
|
|
77
75
|
scrollContent: {
|
|
78
|
-
|
|
76
|
+
width: '100%',
|
|
79
77
|
flexDirection: 'row',
|
|
80
78
|
alignItems: 'center',
|
|
81
|
-
paddingVertical: 10,
|
|
82
|
-
overflow: 'visible'
|
|
83
79
|
}
|
|
84
80
|
});
|