mg-library 1.0.658 → 1.0.660

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.
Files changed (3) hide show
  1. package/blocks.js +0 -18
  2. package/components.js +63 -18
  3. package/package.json +1 -1
package/blocks.js CHANGED
@@ -559,24 +559,6 @@ export function MGCameraPreview(props) {
559
559
  )
560
560
  }
561
561
 
562
- export function MGButton(props) {
563
- return (
564
- <>
565
- <NBButton py={4} colorScheme='primary'
566
- leftIcon={
567
- <NBIcon as={MaterialCommunityIcons} name={props.icon} size='lg' color='white' />
568
- }
569
- onPress={props.callback}>
570
- {!mgFunctionsLib.isEmpty(props.title) &&
571
- <MGText category="p1" color="white">
572
- {props.title}
573
- </MGText>
574
- }
575
- </NBButton>
576
- </>
577
- )
578
- }
579
-
580
562
  export function MGPopover(props) {
581
563
  const [visible, setVisible] = useState(false);
582
564
  const footer = (
package/components.js CHANGED
@@ -1,4 +1,6 @@
1
- import { Box, Text } from '@gluestack-ui/themed';
1
+ import { Box, Text, Button, ButtonText, ButtonIcon, Icon } from '@gluestack-ui/themed';
2
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
+
2
4
  import { MGDivider } from './blocks.js';
3
5
 
4
6
  const categoryMap = {
@@ -57,22 +59,65 @@ export function MGCard({ children, header = null, footer = null, style = {}, ...
57
59
  );
58
60
  }
59
61
 
60
- /* export function MGCard({ children, header = null, footer = null, style = {}, ...props }) {
62
+ export function MGButton({
63
+ title,
64
+ icon,
65
+ callback,
66
+ variant = 'solid',
67
+ action = 'primary',
68
+ ...props
69
+ }) {
70
+ const isSolid = variant === 'solid' || variant === 'filled';
71
+ const textColor = isSolid ? '$white' : `$${action}600`;
72
+ const iconColor = textColor;
73
+ const gsVariant = variant === 'ghost' ? 'link' : variant; // ajustá si querés
74
+ const buttonProps = { action, variant: gsVariant };
61
75
  return (
62
- <Box borderWidth={1} borderRadius="md" borderColor="white" bg="white" shadow={2} overflow="hidden" mb={4} mx={2} style={style} {...props}>
63
- {header && (
64
- <>
65
- <Box p={4}>{header}</Box>
66
- <MGDivider />
67
- </>
68
- )}
69
- <Box p={4}>{children}</Box>
70
- {footer && (
71
- <>
72
- <MGDivider />
73
- <Box p={4}>{footer}</Box>
74
- </>
75
- )}
76
- </Box>
76
+ <Button
77
+ {...buttonProps}
78
+ onPress={callback}
79
+ py="$4"
80
+ {...props}
81
+ >
82
+ {icon ? (
83
+ <ButtonIcon
84
+ as={Icon}
85
+ asIcon={MaterialCommunityIcons}
86
+ name={icon}
87
+ mr="$2"
88
+ color={iconColor}
89
+ />
90
+ ) : null}
91
+
92
+ {title ? (
93
+ <ButtonText
94
+ color={textColor}
95
+ size="md"
96
+ fontWeight="$semibold"
97
+ textTransform="none"
98
+ numberOfLines={1}
99
+ >
100
+ {title}
101
+ </ButtonText>
102
+ ) : null}
103
+ </Button>
77
104
  );
78
- */
105
+ }
106
+
107
+ /* export function MGButton(props) {
108
+ return (
109
+ <>
110
+ <NBButton py={4} colorScheme='primary'
111
+ leftIcon={
112
+ <NBIcon as={MaterialCommunityIcons} name={props.icon} size='lg' color='white' />
113
+ }
114
+ onPress={props.callback}>
115
+ {!mgFunctionsLib.isEmpty(props.title) &&
116
+ <MGText category="p1" color="white">
117
+ {props.title}
118
+ </MGText>
119
+ }
120
+ </NBButton>
121
+ </>
122
+ )
123
+ } */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.658",
3
+ "version": "1.0.660",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {