Skip to content

Commit

Permalink
refactor: Remove button icon size parameter (#5058)
Browse files Browse the repository at this point in the history
The parameter was not used in the app, and also the component in
Figma doesn't support different izon sizes.
  • Loading branch information
gorandalum authored Mar 5, 2025
1 parent 6876c96 commit f445fe8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/components/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type ButtonType = 'large' | 'small';

type ButtonIconProps = {
svg: ({fill}: {fill: string}) => JSX.Element;
size?: keyof Theme['icon']['size'];
notification?: ThemeIconProps['notification'];
};

Expand Down Expand Up @@ -170,7 +169,7 @@ export const Button = React.forwardRef<any, ButtonProps>((props, ref) => {
>
{leftIcon && (
<View style={leftStyling}>
<ThemeIcon color={mainContrastColor} {...leftIcon} />
<ThemeIcon color={mainContrastColor} size="normal" {...leftIcon} />
</View>
)}
{text && (
Expand All @@ -191,7 +190,11 @@ export const Button = React.forwardRef<any, ButtonProps>((props, ref) => {
<ActivityIndicator size="small" color={styleText.color} />
) : (
rightIcon && (
<ThemeIcon color={mainContrastColor} {...rightIcon} />
<ThemeIcon
color={mainContrastColor}
size="normal"
{...rightIcon}
/>
)
)}
</View>
Expand Down Expand Up @@ -262,11 +265,7 @@ const useTextMarginHorizontal = (
const {theme} = useThemeContext();
if (!expand) return 0;
if (!leftIcon && !rightIcon) return 0;
const maxIconSize = Math.max(
theme.icon.size[leftIcon?.size || 'normal'],
theme.icon.size[rightIcon?.size || 'normal'],
);
return maxIconSize + theme.spacing.xSmall;
return theme.icon.size['normal'] + theme.spacing.xSmall;
};

const useButtonStyle = StyleSheet.createThemeHook(() => ({
Expand Down

0 comments on commit f445fe8

Please sign in to comment.