-
Notifications
You must be signed in to change notification settings - Fork 186
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
[PANGOO-2516][BpkNavigationTabGroup] Add Navigation-tab-group component #3599
Conversation
Visit https://backpack.github.io/storybook-prs/3599 to see this build running in a browser. |
Browser supportIf this is a visual change, make sure you've tested it in multiple browsers. |
Visit https://backpack.github.io/storybook-prs/3599 to see this build running in a browser. |
const flightTextElement = screen.getByText('Flights'); | ||
const flightLink = flightTextElement.closest('a'); | ||
|
||
expect(flightLink).toHaveClass('bpk-navigation-tab-wrap--CanvasDefault'); |
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.
Shouldn't this be
expect(flightLink).toHaveClass('bpk-navigation-tab-wrap--CanvasDefault'); | |
expect(flightLink).toHaveClass('bpk-navigation-tab-wrap--canvas-default'); |
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.
@include borders.bpk-border-sm(tokens.$bpk-text-disabled-on-dark-day); | ||
|
||
&:hover { | ||
background-color: tokens.$bpk-core-primary-night; |
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.
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.
Found bpk-private-navigation-tab-hover-day already have been added in bpk-foundations-web by this PR ,so use it in Navigation tab group this commit
} | ||
|
||
&--canvas-default { | ||
background-color: tokens.$bpk-canvas-day; |
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 might need to check this with design because I don't think this is to have a fixed background colour and is just an 'outline'
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.
Thank your clarification, I got it wrong before. As button have default background-color ,so set background-color as transparent in commit
@include borders.bpk-border-sm(tokens.$bpk-core-accent-day); | ||
|
||
&:hover { | ||
background-color: tokens.$bpk-core-accent-day; |
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.
similar here
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.
background-color: tokens.$bpk-canvas-day; | ||
color: tokens.$bpk-text-primary-day; | ||
|
||
@include borders.bpk-border-sm(tokens.$bpk-text-disabled-day); |
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 token should be
@include borders.bpk-border-sm(tokens.$bpk-text-disabled-day); | |
@include borders.bpk-border-sm(tokens.$bpk-line-day); |
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.
Updated in commit
className={tabStyling} | ||
href={tab.href} | ||
onClick={onClick} | ||
aria-current={selected ? 'page' : undefined} |
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.
According to the spec if you set aria-current
to undefined it will set the value to true and tell the assistive tech that the tab is current: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current#values
So here I would probably see
aria-current={selected ? 'page' : undefined} | |
aria-current={selected ? 'page' : false} |
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.
Thanks for your suggestion .Updated in this commit
className={tabStyling} | ||
type="button" | ||
onClick={onClick} | ||
aria-current={selected ? 'page' : undefined} |
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.
Same as above
<nav | ||
className={containerStyling} | ||
role="navigation" | ||
aria-label="Tab Navigation" |
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.
Should this be hard coded like this? What happens when it comes to localisation?
Maybe we need to make this value configurable?
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.
Add airalabel props in this commit
{Icon ? ( | ||
<span | ||
className={getClassName( | ||
'bpk-navigation-tab-icon', | ||
`bpk-navigation-tab-icon--${type}`, | ||
selected && `bpk-navigation-tab-icon--${type}-selected`, | ||
)} | ||
> | ||
<Icon /> | ||
</span> | ||
) : null} |
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 you can simplify this without the if else
by changing to
{Icon ? ( | |
<span | |
className={getClassName( | |
'bpk-navigation-tab-icon', | |
`bpk-navigation-tab-icon--${type}`, | |
selected && `bpk-navigation-tab-icon--${type}-selected`, | |
)} | |
> | |
<Icon /> | |
</span> | |
) : null} | |
{Icon && ( | |
<span | |
className={getClassName( | |
'bpk-navigation-tab-icon', | |
`bpk-navigation-tab-icon--${type}`, | |
selected && `bpk-navigation-tab-icon--${type}-selected`, | |
)} | |
> | |
<Icon /> | |
</span> | |
)} |
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.
Updated in this commit
selectedIndex={0} | ||
/>, | ||
); | ||
expect(asFragment()).toMatchSnapshot(); |
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 tend to move away from snapshot testing as they can be unreliable.
So here we could do a check for the tabs rendering, such as checking for each of the tabs
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.
Remove snapshot testing and tabs element test in this commit
Visit https://backpack.github.io/storybook-prs/3599 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3599 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3599 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3599 to see this build running in a browser. |
During we are doing unified header’s work, we found there is a new navigation tabs component which doesn’t existed in current Backpack components and we need to create one.
So add the Navigation Tab Group component for web, which align with the app
Figma Link
StoryBook
SurfaceContrast:
Without Icon SurfaceContrast:
CanvasDefault:
Without Icon CanvasDefault:
Remember to include the following changes:
[KOA-123][BpkButton] Updating the colour
README.md
(If you have created a new component)README.md