-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(IconButton): Adjust IconButton size. Deprecate
size="large"
an…
…d `children` (#2576)
- Loading branch information
1 parent
f97e256
commit 891308e
Showing
5 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@contentful/f36-button': patch | ||
--- | ||
|
||
IconButton: adjust size, deprecate `size="large"` and `children` props. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/components/button/src/IconButton/IconButton.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { css } from 'emotion'; | ||
import tokens from '@contentful/f36-tokens'; | ||
import { ButtonSize } from '../types'; | ||
|
||
function sizeToStyles(size: ButtonSize) { | ||
switch (size) { | ||
case 'small': { | ||
return { | ||
padding: tokens.spacing2Xs, | ||
minHeight: '32px', | ||
minWidth: '32px', | ||
}; | ||
} | ||
case 'medium': { | ||
return { | ||
padding: tokens.spacingXs, | ||
minHeight: '40px', | ||
minWidth: '40px', | ||
}; | ||
} | ||
default: { | ||
return {}; | ||
} | ||
} | ||
} | ||
|
||
export function getStyles({ size }: { size: ButtonSize }) { | ||
return { | ||
iconButton: css({ | ||
...sizeToStyles(size), | ||
}), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
891308e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
forma-36 – ./
forma-36-git-main.colorfuldemo.com
f36.contentful.com
forma-36.vercel.app
v4.f36.contentful.com
forma-36.colorfuldemo.com