From 04a17f476b1183b6eed486db663b19bf90bd3359 Mon Sep 17 00:00:00 2001 From: Damian Morales Date: Fri, 12 Apr 2024 19:40:54 -0300 Subject: [PATCH] crear componente button --- src/components/Button/index.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 36e24d3..43a5195 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -37,9 +37,9 @@ export enum IconPosition { } interface ButtonProps extends BaseButtonProps { - type: Types, - variant: Variants; - color: Colors; + type?: Types, + variant?: Variants; + color?: Colors; isLoading?: boolean; value?: string | null; icon?: string; @@ -86,14 +86,12 @@ const Button: FC = ({ const pressedStyle = isPressed ? palette.primary.dark : palette.primary.main; const bgColor = !disabled ? pressedStyle : palette.grey[200]; - const validateFontSize = scaledForDevice(14, moderateScale); - const styles = StyleSheet.create({ container: { backgroundColor: bgColor, }, - wrapperDirection: { + directionWrapper: { flexDirection: 'row', justifyContent: 'center', alignItems: 'center' @@ -102,7 +100,7 @@ const Button: FC = ({ color: palette.base.white, }, text: { - fontSize: validateFontSize, + fontSize: scaledForDevice(14, moderateScale), fontWeight: '500', textAlign: 'center', color: palette.base.white, @@ -127,8 +125,8 @@ const Button: FC = ({ /> ); - const ButtonWrapper = ( - + const WrapperComponent = ( + {icon && } {value && {value}} @@ -140,7 +138,7 @@ const Button: FC = ({ onPressIn={useCallback(handleOnPressIn, [setIsPressed, isPressed])} onPressOut={useCallback(handleOnPressOut, [setIsPressed, isPressed])} {...props}> - {isLoading ? LoadingCompontent : ButtonWrapper} + {isLoading ? LoadingCompontent : WrapperComponent} ); };