Skip to content

Commit 6d78637

Browse files
skogsmaskinbjoerge
authored andcommitted
[components] Support disabled prop on ToggleButton
1 parent 38279a1 commit 6d78637

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/@sanity/components/src/toggles/ToggleButton.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ export default class ToggleButton extends React.Component {
88
icon: PropTypes.func,
99
onClick: PropTypes.func.isRequired,
1010
selected: PropTypes.bool,
11+
disabled: PropTypes.bool,
1112
children: PropTypes.node,
1213
className: PropTypes.string,
1314
title: PropTypes.string
1415
}
1516

1617
static defaultProps = {
17-
className: ''
18+
className: '',
19+
disabled: false
1820
}
1921

2022
render() {
21-
const {selected, icon, className, title} = this.props
23+
const {disabled, selected, icon, className, title} = this.props
2224
const buttonClasses = `
2325
${selected ? styles.selected : styles.unSelected}
2426
${className}
@@ -28,6 +30,7 @@ export default class ToggleButton extends React.Component {
2830
className={buttonClasses}
2931
icon={icon}
3032
title={title}
33+
disabled={disabled}
3134
onClick={this.props.onClick}
3235
kind="simple"
3336
>

packages/@sanity/components/src/toggles/story.js

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ storiesOf('Toggles')
8080
<Sanity part="part:@sanity/components/toggles/buttons" propTables={[ToggleButtons]}>
8181
<ToggleButton
8282
selected={boolean('selected (prop)', false)}
83+
disabled={boolean('disabled (prop)', false)}
8384
onClick={action('onClick')}
8485
icon={icon}
8586
>

0 commit comments

Comments
 (0)