-
Notifications
You must be signed in to change notification settings - Fork 27
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a73bac4
just writing out ideas
LinKCoding 0818d47
more progress
LinKCoding e4d98d9
Merge branch 'main' into kl-gm-591
LinKCoding 7c075f5
working icon
LinKCoding 7cde109
added example with background in story, checking if type isn't recogn…
LinKCoding c393038
prettified
LinKCoding fea7904
made icon optional
LinKCoding 3e8178d
Merge branch 'main' into kl-gm-591
LinKCoding cada44d
changed box to flexbox to center icon
LinKCoding f686d39
moved shared types to utils
LinKCoding 52f85ac
added withChildren prop
LinKCoding a5c5466
prettified and built
LinKCoding 73e87c5
added extra margins for badges with icons
LinKCoding 032e70f
prettified
LinKCoding 674e8f2
changing margins"
LinKCoding b236977
prettied
LinKCoding c9c94c3
Merge branch 'main' into kl-gm-591
LinKCoding 6e976e0
removed testing stories
LinKCoding c1843ce
adding optional spacing
LinKCoding ef79235
added centering and updated examples
LinKCoding e9ad33b
prettified"
LinKCoding File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,17 @@ | ||
const iconSizeMap = { | ||
base: 16, | ||
sm: 8, | ||
} as const; | ||
|
||
export const determineIconSize = (size: keyof typeof iconSizeMap) => { | ||
return iconSizeMap[size]; | ||
}; | ||
|
||
const iconSpaceMap = { | ||
base: 8, | ||
sm: 4, | ||
} as const; | ||
|
||
export const determineIconSpacing = (size: keyof typeof iconSizeMap) => { | ||
return iconSpaceMap[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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export * from './childrenType'; | ||
export * from './createPromise'; | ||
export * from './generateResponsiveClassnames'; | ||
export * from './omitProps'; | ||
export * from './useIsMounted'; | ||
export * from './types'; |
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,7 @@ | ||
import { GamutIconProps } from '@codecademy/gamut-icons'; | ||
|
||
export interface WithChildrenProp { | ||
children?: React.ReactNode | React.ReactNode[]; | ||
} | ||
|
||
export type IconComponentType = { icon: React.ComponentType<GamutIconProps> }; | ||
Comment on lines
+1
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. love ittt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Badge } from '@codecademy/gamut'; | ||
import { Background } from '@codecademy/gamut-styles'; | ||
|
||
export const TertiaryFillExample = () => { | ||
return ( | ||
<Background bg="background-primary"> | ||
<Badge variant="tertiary">tertiary ex</Badge> | ||
<Badge variant="tertiaryFill">tertiaryFill ex</Badge> | ||
</Background> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
all of the SB examples look great but noticed the portal example is very slightly wonky -
i think wrapping children in 100% width centered Flexbox should fix that! if it persists you may need to tweak lineHeight too 🤔
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