Skip to content

Commit

Permalink
fix: styling for icon button and field label (#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhurisandbhor authored Jul 25, 2024
1 parent 6972656 commit 60dd5ee
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-pans-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@strapi/design-system': patch
---

fix: icon button default size updated to small
4 changes: 2 additions & 2 deletions docs/stories/04-components/IconButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ variants available. However, `tertiary` is considered the default.

<Canvas of={IconButtonStories.Disabled} />

### Small Size
### Medium Size

<Canvas of={IconButtonStories.SizeSmall} />
<Canvas of={IconButtonStories.SizeMedium} />

### Large Size

Expand Down
9 changes: 4 additions & 5 deletions docs/stories/04-components/IconButton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const meta: Meta<IconButtonArgs> = {
disabled: false,
label: 'More actions',
onClick: fn(),
size: 'M',
variant: 'tertiary',
},
argTypes: {
Expand Down Expand Up @@ -94,22 +93,22 @@ export const Disabled = {
name: 'disabled',
} satisfies Story;

export const SizeSmall = {
export const SizeMedium = {
args: {
size: 'S',
size: 'M',
},
parameters: {
docs: {
source: {
code: outdent`
<IconButton size="S" label="More actions">
<IconButton size="M" label="More actions">
<More />
</IconButton>
`,
},
},
},
name: 'size small',
name: 'size medium',
} satisfies Story;

export const SizeLarge = {
Expand Down
1 change: 1 addition & 0 deletions packages/design-system/src/components/Field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const Label = React.forwardRef<HTMLLabelElement, LabelProps>(({ children, action
id={`${id}-label`}
htmlFor={id}
tag="label"
ellipsis
>
{children}
{required && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const IconButton = forwardRef(
children,
disabled = false,
onClick,
size = 'M',
size = 'S',
variant = 'tertiary',
withTooltip = true,
...restProps
Expand Down Expand Up @@ -81,8 +81,8 @@ const IconButtonWrapper = styled<FlexComponent<'button'>>(Flex)<IconButtonWrappe
switch (props.$size) {
case 'S': {
return css`
padding-block: 0.6rem;
padding-inline: 0.6rem;
padding-block: 0.7rem;
padding-inline: 0.7rem;
`;
}
case 'M': {
Expand Down

0 comments on commit 60dd5ee

Please sign in to comment.