-
Notifications
You must be signed in to change notification settings - Fork 377
feat(tabs): add secondary border-bottom variation, update demos #7311
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,8 +41,10 @@ export interface TabsProps extends Omit<React.HTMLProps<HTMLElement | HTMLDivEle | |||||||||
| isBox?: boolean; | ||||||||||
| /** Enables vertical tab styling */ | ||||||||||
| isVertical?: boolean; | ||||||||||
| /** Enables no border bottom tab styling */ | ||||||||||
| /** Enables border bottom tab styling on tabs. Defaults to true. To remove the bottom border, set this prop to false. */ | ||||||||||
| hasBorderBottom?: boolean; | ||||||||||
| /** Enables border bottom styling for secondary tabs */ | ||||||||||
| hasSecondaryBorderBottom?: boolean; | ||||||||||
|
Contributor
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. Is a new prop necessary? if the consumer specifies isSecondary and hasBorderBottom, could it do the same thing?
Collaborator
Author
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. I debated that myself, but since hasBorderBottom defaults to true I worried that doing so would cause visual changes to applications that currently use secondary tabs which may not want the bottom border.
Contributor
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. Maybe we can update this with the next breaking change release? Assuming we want secondary tabs to also default to having a bottom border like default tabs.
Collaborator
Author
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. @kmcfaul I think that would be ideal. |
||||||||||
| /** Aria-label for the left scroll button */ | ||||||||||
| leftScrollAriaLabel?: string; | ||||||||||
| /** Aria-label for the right scroll button */ | ||||||||||
|
|
@@ -292,6 +294,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> { | |||||||||
| isVertical, | ||||||||||
| isBox, | ||||||||||
| hasBorderBottom, | ||||||||||
| hasSecondaryBorderBottom, | ||||||||||
| leftScrollAriaLabel, | ||||||||||
| rightScrollAriaLabel, | ||||||||||
| 'aria-label': ariaLabel, | ||||||||||
|
|
@@ -361,6 +364,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> { | |||||||||
| showScrollButtons && !isVertical && styles.modifiers.scrollable, | ||||||||||
| usePageInsets && styles.modifiers.pageInsets, | ||||||||||
| !hasBorderBottom && styles.modifiers.noBorderBottom, | ||||||||||
| hasSecondaryBorderBottom && styles.modifiers.borderBottom, | ||||||||||
|
Comment on lines
366
to
+367
Contributor
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.
Suggested change
Collaborator
Author
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. I think that would still cause breaking changes since |
||||||||||
| formatBreakpointMods(inset, styles), | ||||||||||
| variantStyle[variant], | ||||||||||
| className | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
Based on the prop description, I'm guessing you tested a
hasNoBorderBottomprop, which is what we want based on the core docs: https://patternfly-pr-4774.surge.sh/components/tabs/The (default, non-secondary) tabs have a bottom border by default, so it makes sense to have a prop that lets a consumer remove the bottom border.
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
hasBorderBottomwas originallyhasNoBorderBottomin #7183 when I first PR'd it. @kmcfaul @nicolethoen I'd appreciate your thoughts on this suggestion. I'm a fan but since you both advocated forhasBorderBottomI'm hesitant to change it before getting your input.Thank you for putting this much thought into it!
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 still like
hasBorderBottomoverhasNoBorderBottompersonally, where passingfalseadds the modifier css. I don't think it needs to match core's modifiers 1:1 in this case.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.
Ah okay, thank you for linking the comment thread @wise-king-sullyman and for sharing your input @kmcfaul !
Avoiding the double negative makes sense. If that's the case then we would want to keep both
hasBorderBottomandhasSecondaryBorderBottomfor the styling to work as expected. I've added a suggestion to update the prop description which would clarify the use case ofhasBorderBottoma bit better - WDYT @wise-king-sullyman?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.
That suggestion looks great to me @jenny-s51, thank you for doing it!