Skip to content

Commit dabd148

Browse files
committed
fix(ui-tabs): fix bottom border of Tab with scrolling overflow in secondary variant
INSTUI-4604
1 parent 5de3e7b commit dabd148

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

packages/ui-tabs/src/Tabs/Tab/props.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ type TabsTabOwnProps = {
5050
tabData: { index: number; id: string }
5151
) => void
5252
children?: Renderable
53+
/**
54+
* Whether tabOverflow prop in Tabs is set to 'scroll'.
55+
*/
56+
isOverflowScroll?: boolean
5357
}
5458

5559
type PropKeys = keyof TabsTabOwnProps
@@ -71,7 +75,8 @@ const propTypes: PropValidators<PropKeys> = {
7175
isSelected: PropTypes.bool,
7276
onClick: PropTypes.func,
7377
onKeyDown: PropTypes.func,
74-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
78+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
79+
isOverflowScroll: PropTypes.bool
7580
}
7681

7782
const allowedProps: AllowedPropKeys = [
@@ -83,7 +88,8 @@ const allowedProps: AllowedPropKeys = [
8388
'isSelected',
8489
'onClick',
8590
'onKeyDown',
86-
'children'
91+
'children',
92+
'isOverflowScroll'
8793
]
8894

8995
export type { TabsTabProps, TabsTabStyle }

packages/ui-tabs/src/Tabs/Tab/styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const generateStyle = (
4949
componentTheme: TabsTabTheme,
5050
props: TabsTabProps
5151
): TabsTabStyle => {
52-
const { variant, isSelected, isDisabled } = props
52+
const { variant, isSelected, isDisabled, isOverflowScroll } = props
5353

5454
const variants = {
5555
default: {
@@ -90,7 +90,7 @@ const generateStyle = (
9090
padding: '0.75rem 1rem', // if horizontal padding changes, update `scrollOverlayWidthSecondary` in `Tabs/theme.js`
9191
color: componentTheme.secondaryColor,
9292
marginInlineEnd: '0.2em',
93-
marginBottom: '-0.0625rem',
93+
marginBottom: isOverflowScroll ? '0rem' : '-0.0625rem',
9494
border: '0.0625rem solid transparent',
9595
borderTopLeftRadius: '0.1875rem',
9696
borderTopRightRadius: '0.1875rem',

packages/ui-tabs/src/Tabs/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ class Tabs extends Component<TabsProps, TabsState> {
359359
isDisabled={panel.props.isDisabled}
360360
onClick={this.handleTabClick}
361361
onKeyDown={this.handleTabKeyDown}
362+
isOverflowScroll={this.props.tabOverflow === 'scroll'}
362363
>
363364
{panel.props.renderTitle}
364365
</Tab>

packages/ui-tabs/src/Tabs/styles.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ const generateStyle = (
6262
flexFlow: 'row wrap'
6363
},
6464
scroll: {
65+
marginBottom:
66+
variant === 'secondary'
67+
? `calc(${componentTheme.tabVerticalOffset} * -1)`
68+
: 0,
6569
overflowX: 'auto',
6670
...(variant === 'default' && {
6771
'&::-webkit-scrollbar-track': {

0 commit comments

Comments
 (0)