Skip to content

Commit

Permalink
Fixes icon-only button extra padding
Browse files Browse the repository at this point in the history
  • Loading branch information
AyIong committed Jan 8, 2025
1 parent ee94a15 commit bdaa8b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function Button(props: Props) {
<div className="Button__content">
{icon && iconPosition !== 'right' && (
<Icon
mr={toDisplay ? 0.5 : 0}
mr={toDisplay && 0.5}
name={icon}
color={iconColor}
rotation={iconRotation}
Expand All @@ -173,7 +173,7 @@ export function Button(props: Props) {
)}
{icon && iconPosition === 'right' && (
<Icon
ml={toDisplay ? 0.5 : 0}
ml={toDisplay && 0.5}
name={icon}
color={iconColor}
rotation={iconRotation}
Expand Down
19 changes: 16 additions & 3 deletions stories/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,28 @@ export const Default: Story = {
},
};

type CheckboxStory = StoryObj<ComponentProps<typeof Button.Checkbox>>;

export const WithIcon: Story = {
args: {
children: 'Submit',
icon: 'envelope',
},

render: (args) => {
return (
<>
<Button {...args}>Default</Button>
<br />
<Button {...args} iconPosition="right">
Icon Right
</Button>
<br />
<Button {...args} /> Only Icon
</>
);
},
};

type CheckboxStory = StoryObj<ComponentProps<typeof Button.Checkbox>>;

export const Checkbox: CheckboxStory = {
args: {
children: 'Click me',
Expand Down

0 comments on commit bdaa8b4

Please sign in to comment.