-
Notifications
You must be signed in to change notification settings - Fork 81
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`
- Loading branch information
1 parent
a23f361
commit 21cd4f8
Showing
4 changed files
with
110 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. |
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