Skip to content

Commit

Permalink
crear componente button
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Morales committed Apr 12, 2024
1 parent 98afd40 commit 04a17f4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -86,14 +86,12 @@ const Button: FC<ButtonProps> = ({
const pressedStyle = isPressed ? palette.primary.dark : palette.primary.main;
const bgColor = !disabled ? pressedStyle : palette.grey[200];

Check warning on line 88 in src/components/Button/index.tsx

View workflow job for this annotation

GitHub Actions / Build

Trailing spaces not allowed
const validateFontSize = scaledForDevice(14, moderateScale);


const styles = StyleSheet.create({
container: {
backgroundColor: bgColor,
},
wrapperDirection: {
directionWrapper: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center'

Check warning on line 97 in src/components/Button/index.tsx

View workflow job for this annotation

GitHub Actions / Build

Missing trailing comma
Expand All @@ -102,7 +100,7 @@ const Button: FC<ButtonProps> = ({
color: palette.base.white,
},
text: {
fontSize: validateFontSize,
fontSize: scaledForDevice(14, moderateScale),
fontWeight: '500',
textAlign: 'center',
color: palette.base.white,
Expand All @@ -127,8 +125,8 @@ const Button: FC<ButtonProps> = ({
/>
);

const ButtonWrapper = (
<View style={styles.wrapperDirection}>
const WrapperComponent = (
<View style={styles.directionWrapper}>
{icon && <Icon name={icon} style={[styles.icon, iconStyle]} size={24} />}
{value && <Text style={[styles.text, textStyle]}>{value}</Text>}
</View>
Expand All @@ -140,7 +138,7 @@ const Button: FC<ButtonProps> = ({
onPressIn={useCallback(handleOnPressIn, [setIsPressed, isPressed])}
onPressOut={useCallback(handleOnPressOut, [setIsPressed, isPressed])}
{...props}>
{isLoading ? LoadingCompontent : ButtonWrapper}
{isLoading ? LoadingCompontent : WrapperComponent}
</BaseButton>
);
};
Expand Down

0 comments on commit 04a17f4

Please sign in to comment.