-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Design System: Refactor IconButton and update documentation #66774
Conversation
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.
It seems like xl
icons have grown a lot in hover state... Is our recommendation that those change to lg
icons now? I feel like we have to address the hover size changes because they are quite drastic...
We definitely need to discuss the sizes for xl and lg that's why I added it as a topic to our Saga weekly on Monday. |
@@ -125,9 +125,8 @@ export const DynamicTable = <T extends object>({ | |||
<div className={cx(styles.cell, styles.expandCell)}> | |||
<IconButton | |||
aria-label={`${isItemExpanded ? 'Collapse' : 'Expand'} row`} | |||
size="lg" |
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.
Since the padding according to Figma especially for larger sizes would break the UI @staton-hyse11, @JoaoSilvaGrafana and I decided to set the padding to 4px for each size and let the IconSize define how large the hover state is becoming. |
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.
I think it looks better now with the 4px!
const getStyles = stylesFactory((theme: GrafanaTheme2, size, variant: IconButtonVariant) => { | ||
// overall size of the IconButton on hover | ||
// the value 8 originates from 2*4px and letting the IconSize generally decide on the hoverSize | ||
const hoverSize = getSvgSize(size) + 8; |
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.
we should make it use the theme here, so 2 * theme.spacing(0.5)
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.
Unfortunately theme.spacing()
is returning a string including 'px'.
I could do something like parseInt(theme.spacing(0.5).substring(0))
but this is cumbersome. What do you think?
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.
Oh thats true... We could also use theme.spacing.gridSize
which returns 8
? And keep this in mind when we do spacing tokens
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.
I changed it to theme.spacing.gridSize
, modified the related comment in the code and added a reminder to the related epic for spacing tokens.
packages/grafana-ui/src/components/IconButton/IconButton.story.tsx
Outdated
Show resolved
Hide resolved
packages/grafana-ui/src/components/IconButton/IconButton.story.tsx
Outdated
Show resolved
Hide resolved
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.
Lgtm! 🙌
* refactor: remove unnecessary styling and adjust to button styling * refactor: improve story * refactor: use new default styling for border radius * refactor: add missing pseudo classes and clean up * refactor: repair disabled styling and add to story * refactor: clean up and apply styles defined in figma * refactor: set hover background in a pseudo-element * refactor: unify large sizes * refactor: add information for further use * refactor: add comment * refactor: comments and clean up import * refactor: add changes after code review * refactor: replace some bad example code in documentation * refactor: update comment Co-authored-by: Joao Silva <[email protected]> * refactor: add changes requested in review * refactor: move deprecation warning * refactor: replace padding * refactor: remove local styling * refactor: create separate stories for different examples * refactor: change style of story * refactor: replace absolute value by variable * Update toggles_gen.go --------- Co-authored-by: Joao Silva <[email protected]>
Which issue(s) does this PR fix?:
Fixes #66600
Special notes for your reviewer:
Note: All sizes of plain button elements correspond with icon sizes.