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
feat(badge): adding leading-icon
to badge
#2868
base: main
Are you sure you want to change the base?
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.
code looks great! one small tweak on some centering then it's good to go 🔥
packages/gamut/src/Badge/index.tsx
Outdated
<Icon height={size} width={size} /> | ||
</FlexBox> | ||
)} | ||
{children} |
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.
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.
Ahhhh that's on me... probably a bad example to just tweak, there was some margin stuff in there that I didn't consider. Sorry about that :(
oddly enough, I don't see the text being shifted - admittedly, I removed the margin and put it back just as a sanity check and it looks fine to me
the badge seems to have a flex display and align-items: center
.
I temporarily changed it in storybook and it looks good (just in case it was an issue with the icon itself)
maybe we can look at this together on Monday.
Thanks Cass :)
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.
yeah that looks great now!
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.
but now I'm paranoid about why you saw what you saw lol
import { GamutIconProps } from '@codecademy/gamut-icons'; | ||
|
||
export interface WithChildrenProp { | ||
children?: React.ReactNode | React.ReactNode[]; | ||
} | ||
|
||
export type IconComponentType = { icon: React.ComponentType<GamutIconProps> }; |
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.
love ittt
In the end, I opted to give 2px margins for both sized badge variants. I also added a bunch more examples in SB -- more so just for reviewing. |
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.
check it out in light mode and dark mode and both looks great! 🚢
📬Published Alpha Packages:@codecademy/gamut@55.19.2-alpha.6e976e.0 |
🚀 Styleguide deploy preview ready! |
Overview
Adding an icon prop to the badge component.
Also adding a tertiary-fill variant for badges.
PR Checklist
Testing Instructions
For Mono:
For the monolith:
PR Links and Envs