-
Notifications
You must be signed in to change notification settings - Fork 107
[v12] feat(ui-heading): rework Heading #2365
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
base: v12
Are you sure you want to change the base?
Conversation
|
| fontWeight: componentTheme.weightImportant, | ||
| fontSize: componentTheme.titlePageDesktop, | ||
| lineHeight: componentTheme.lineHeight125 | ||
| ...componentTheme.titlePageDesktop |
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.
this is a composit token now
| if (aiVariant === 'stacked') { | ||
| return ( | ||
| <> | ||
| <span css={this.props.styles?.igniteAIStacked}> | ||
| <IconAiColoredSolid /> | ||
| <span css={this.props.styles?.igniteAI}>IgniteAI</span> | ||
| </span> | ||
| {children} | ||
| </> | ||
| ) | ||
| } | ||
| if (aiVariant === 'horizontal') { | ||
| return ( | ||
| <> | ||
| <IconAiColoredSolid /> | ||
| <span css={this.props.styles?.igniteAI}>IgniteAI</span> | ||
| <StarsInstUIIcon color="ai" size="sm" /> | ||
| {children} | ||
| </> | ||
| ) | ||
| } | ||
| if (aiVariant === 'iconOnly') { | ||
| return ( | ||
| <> | ||
| <IconAiColoredSolid /> | ||
| {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.
I think this is some dead code/duplication as the 'stacked', 'horizontal' and 'iconOnly' AI cases are already checked above...(?)
| return ( | ||
| <span css={[this.props.styles?.withIcon]} aria-hidden="true"> | ||
| {callRenderProp(renderIcon)} {children} | ||
| {renderIconWithProps(renderIcon, iconSize, 'inherit')} |
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.
I set a gap for that, can you please check it? (As with no variant or level specified, the component defaults to a h2 and that usually has a gapIconLg)
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 just realized that the icon size doesn’t change based on the heading level, so H1 and H6 headings both use the same 20px icon. We should fix that and adjust the gap as well. I'll send you the mapping soon
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 was wrong it works with the Level prop but when I set the "as" prop it changes the font-size but it doesn't change the icon size. I write you on Slack about this
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.
@adamlobler Okay, I fixed the as prop, can you check these please:
<div>
<Heading as="h1" renderIcon={<IconAdminSolid/>}>titlePageDesktop</Heading><br/>
<Heading as="h2" renderIcon={<IconAdminSolid/>}>titlePageMobile</Heading><br/>
<Heading as="h3" renderIcon={<IconAdminSolid/>}>titleSection</Heading><br/>
<Heading as="h4" renderIcon={<IconAdminSolid/>}>titleCardSection</Heading><br/>
<Heading as="h5" renderIcon={<IconAdminSolid/>}>titleModule</Heading><br/>
<Heading as="h6" renderIcon={<IconAdminSolid/>}>titleCardLarge</Heading><br/>
</div>
Also I realized the AI variants can have different levels, can you please check these too for the icon sizes and gaps?
<div style={{display: 'flex', flexDirection: 'column', gap: '24px'}}>
<Heading aiVariant="horizontal" level="h1">Main Title - Heading 1</Heading>
<Heading aiVariant="horizontal" level="h2">Section Title - Heading 2</Heading>
<Heading aiVariant="horizontal" level="h3">Nutrition Facts - Heading 3</Heading>
<Heading aiVariant="horizontal" level="h4">Subsection - Heading 4</Heading>
<Heading aiVariant="horizontal" level="h5">Detail Category - Heading 5</Heading>
<Heading aiVariant="horizontal" level="h6">Fine Print - Heading 6</Heading>
</div>
<div style={{display: 'flex', flexDirection: 'column', gap: '24px'}}>
<Heading aiVariant="horizontal" variant="titlePageDesktop">titlePageDesktop</Heading>
<Heading aiVariant="horizontal" variant="titlePageMobile">titlePageMobile</Heading>
<Heading aiVariant="horizontal" variant="titleSection">titleSection</Heading>
<Heading aiVariant="horizontal" variant="titleCardSection">titleCardSection</Heading>
<Heading aiVariant="horizontal" variant="titleModule">titleModule</Heading>
<Heading aiVariant="horizontal" variant="titleCardLarge">titleCardLarge</Heading>
<Heading aiVariant="horizontal" variant="titleCardRegular">titleCardRegular</Heading>
<Heading aiVariant="horizontal" variant="titleCardMini">titleCardMini</Heading>
<Heading aiVariant="horizontal" variant="label">label</Heading>
<Heading aiVariant="horizontal" variant="labelInline">labelInline</Heading>
</div>
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.
Great, thanks for the code snippets! The base ones look great, but in the AI variants the gaps aren’t aligned with the textsizes. Could you use the same gaps we use in the base ones for each heading level?
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.
@adamlobler I fixed this, can you please check it now?
| static defaultProps = { | ||
| children: null, | ||
| border: 'none', | ||
| color: 'inherit' |
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.
I chose to modify the examples a bit rather then changing the default "inherit" value because that can have some breaking changes.
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 see your point, but I’m a bit concerned that these Heading components will mostly receive raw hex values that won’t work across light and dark modes.
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.
@adamlobler Ok, I changed the default to "primary", check the examples in dark mode please
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.
@matyasf can you check this conv? I’m not 100% sure about it, but it feels like the safer approach when introducing dark mode.
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 too that primary is better. Otherwise users might not set it to set to a wrong color and it will look off/have a11y issues. Be sure to mention this in the changelog (afaik I've done the same for Text)
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 put in into the changelog.
ed57ffd to
467fc85
Compare
adamlobler
left a comment
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.
The icon size and the gap don’t align with the font-size when only the as prop is set.
467fc85 to
464c80a
Compare
adamlobler
left a comment
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.
In the AI variants the gaps between the icon and the text aren’t aligned with the textsizes, they are always 0.25rem
INSTUI-4869
464c80a to
d6810e2
Compare
adamlobler
left a comment
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.
Perfect, thanks for the modifications 🙌
matyasf
left a comment
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.
nice work!



INSTUI-4869
ISSUE:
Heading needs to be migrated to the new theming system
TEST PLAN: