Skip to content
This repository was archived by the owner on Oct 19, 2021. It is now read-only.

Commit 986bf7c

Browse files
asudohemyarod
authored andcommitted
fix(Tab): add missing disabled prop (#2234)
Refs #1293.
1 parent 6190488 commit 986bf7c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/components/Tab/Tab.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export default class Tab extends React.Component {
3737
*/
3838
handleTabKeyDown: PropTypes.func,
3939

40+
/**
41+
* Whether your Tab is disabled.
42+
*/
43+
disabled: PropTypes.bool,
44+
4045
/**
4146
* Provide a string that represents the `href` of the Tab
4247
*/
@@ -114,6 +119,7 @@ export default class Tab extends React.Component {
114119
handleTabClick,
115120
handleTabAnchorFocus, // eslint-disable-line
116121
handleTabKeyDown,
122+
disabled,
117123
href,
118124
index,
119125
label,
@@ -125,11 +131,10 @@ export default class Tab extends React.Component {
125131
...other
126132
} = this.props;
127133

128-
const classes = classNames(
129-
`${prefix}--tabs__nav-item`,
130-
{ [`${prefix}--tabs__nav-item--selected`]: selected },
131-
className
132-
);
134+
const classes = classNames(className, `${prefix}--tabs__nav-item`, {
135+
[`${prefix}--tabs__nav-item--disabled`]: disabled,
136+
[`${prefix}--tabs__nav-item--selected`]: selected,
137+
});
133138

134139
const anchorProps = {
135140
className: `${prefix}--tabs__nav-link`,

src/components/Tabs/Tabs-story.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import React from 'react';
99
import { storiesOf } from '@storybook/react';
1010
import { action } from '@storybook/addon-actions';
1111

12-
import { withKnobs, number, text } from '@storybook/addon-knobs';
12+
import { withKnobs, boolean, number, text } from '@storybook/addon-knobs';
1313
import Tabs from '../Tabs';
1414
import Tab from '../Tab';
1515
import TabsSkeleton from '../Tabs/Tabs.Skeleton';
@@ -36,6 +36,7 @@ const props = {
3636
),
3737
}),
3838
tab: () => ({
39+
disabled: boolean('Disabled (disabled in <Tab>)', false),
3940
href: text('The href for tab (href in <Tab>)', '#'),
4041
role: text('ARIA role (role in <Tab>)', 'presentation'),
4142
tabIndex: number('Tab index (tabIndex in <Tab>)', 0),

0 commit comments

Comments
 (0)