-
Notifications
You must be signed in to change notification settings - Fork 355
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(tabs): add secondary border-bottom variation, update demos #7311
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; | ||||||||||
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? 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. 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. 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
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
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 | ||||||||||
|
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
hasNoBorderBottom
prop, 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
hasBorderBottom
was originallyhasNoBorderBottom
in #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 forhasBorderBottom
I'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
hasBorderBottom
overhasNoBorderBottom
personally, where passingfalse
adds 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
hasBorderBottom
andhasSecondaryBorderBottom
for the styling to work as expected. I've added a suggestion to update the prop description which would clarify the use case ofhasBorderBottom
a 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!