-
Notifications
You must be signed in to change notification settings - Fork 114
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
fix(tabs): center align horizontal tabs always #1567
Conversation
🦋 Changeset detectedLatest commit: 9604bd1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Change: -8 B (0%) Total Size: 555 kB
ℹ️ View Unchanged
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9604bd1:
|
0c2854e
to
828b5e1
Compare
@@ -2,21 +2,11 @@ import * as React from 'react'; | |||
import {render, screen} from '@testing-library/react'; | |||
// @ts-ignore typescript doesn't like js imports | |||
import axe from '../../../../../.jest/axe-helper'; | |||
import {HorizontalTabsExample, VerticalTabsExample, StateHookExample} from '../stories/index.stories'; | |||
import {HorizontalTabs, StateHookTabs} from '../stories/index.stories'; |
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.
🔥
|
||
export const HorizontalTabs = (): React.ReactNode => { | ||
return <HorizontalTabsExample />; | ||
// @ts-expect-error story |
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.
Not sure whats better here. Having the @ts-expect-error
or having the extra code to exclude the ...Example
stories. Thoughts?
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 I prefer TS hints to say "this is fine" over adding more code, but I don't really have a strong opinion.
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 don't really have a strong opinion on this either. We need a tie-breaker @SiTaggart.
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 may not be a true tie-breaker.
In other stories we type the functional component to return React.ReactNode
, which is kinda icky but gets around the type error.
In other places like tests I'm pretty partial to not having to do really extreme typescript things it's being picky about because they're tests but, I'm not sure if that's "artisan" and won't bite us in the bum. In those instances where we explicitly expect the type error, I always forget @ts-expect-error
and I think it's probably the best way to go.
Finally, amusing the .story
annotations are deprecated anyway https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#hoisted-csf-annotations
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.
Lol. I guess this is fine then? We could also create our own re-useable type in the future:
type Story<P> = React.FC<P> & {
story: {}
// In the future, the other ones they added to replace story
}
Code and VRT look good. Just that one question about the stories. |
All horizontal tab labels are now center aligned. This PR also updates the stories to include inclusive content and VRT the center alignment change.