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

Commit

Permalink
fix(Tab): add missing disabled prop (#2234)
Browse files Browse the repository at this point in the history
Refs #1293.
  • Loading branch information
asudoh authored and emyarod committed Apr 25, 2019
1 parent 6190488 commit 986bf7c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/components/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export default class Tab extends React.Component {
*/
handleTabKeyDown: PropTypes.func,

/**
* Whether your Tab is disabled.
*/
disabled: PropTypes.bool,

/**
* Provide a string that represents the `href` of the Tab
*/
Expand Down Expand Up @@ -114,6 +119,7 @@ export default class Tab extends React.Component {
handleTabClick,
handleTabAnchorFocus, // eslint-disable-line
handleTabKeyDown,
disabled,
href,
index,
label,
Expand All @@ -125,11 +131,10 @@ export default class Tab extends React.Component {
...other
} = this.props;

const classes = classNames(
`${prefix}--tabs__nav-item`,
{ [`${prefix}--tabs__nav-item--selected`]: selected },
className
);
const classes = classNames(className, `${prefix}--tabs__nav-item`, {
[`${prefix}--tabs__nav-item--disabled`]: disabled,
[`${prefix}--tabs__nav-item--selected`]: selected,
});

const anchorProps = {
className: `${prefix}--tabs__nav-link`,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Tabs/Tabs-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';

import { withKnobs, number, text } from '@storybook/addon-knobs';
import { withKnobs, boolean, number, text } from '@storybook/addon-knobs';
import Tabs from '../Tabs';
import Tab from '../Tab';
import TabsSkeleton from '../Tabs/Tabs.Skeleton';
Expand All @@ -36,6 +36,7 @@ const props = {
),
}),
tab: () => ({
disabled: boolean('Disabled (disabled in <Tab>)', false),
href: text('The href for tab (href in <Tab>)', '#'),
role: text('ARIA role (role in <Tab>)', 'presentation'),
tabIndex: number('Tab index (tabIndex in <Tab>)', 0),
Expand Down

0 comments on commit 986bf7c

Please sign in to comment.