Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix IconButton width in style prop not working when feature flag is on #5091

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silver-cheetahs-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Bug fix for `IconButton` to respect the `style` prop width when the feature flag is on.
4 changes: 1 addition & 3 deletions packages/react/src/Button/ButtonBase.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

/* IconButton */

&:where(.IconButton) {
&.IconButton {
display: inline-grid;
width: var(--control-medium-size);
min-width: unset;
Expand All @@ -78,12 +78,10 @@

&:where([data-size='small']) {
width: var(--control-small-size);
min-width: var(--control-small-size);
}

&:where([data-size='large']) {
width: var(--control-large-size);
min-width: var(--control-large-size);
}
}

Expand Down
15 changes: 14 additions & 1 deletion packages/react/src/Button/IconButton.dev.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ChevronDownIcon} from '@primer/octicons-react'
import {BoldIcon, ChevronDownIcon} from '@primer/octicons-react'
import React from 'react'
import {IconButton} from '.'
import Box from '../Box'

export default {
title: 'Components/IconButton/DevOnly',
Expand All @@ -25,3 +26,15 @@ export const CustomSizeWithMedia = () => {
export const CustomIconColor = () => (
<IconButton aria-label="Expand" variant="invisible" size="small" icon={ChevronDownIcon} sx={{color: 'red'}} />
)

export const CustomSizeWithStyleProp = () => (
<Box sx={{border: '1px solid', borderColor: 'border.default', display: 'inline-block'}}>
<IconButton
icon={BoldIcon}
aria-label="Bold"
size="large"
variant="invisible"
style={{width: '20px', height: '28px'}}
/>
</Box>
)
Loading