From c76fa9aa192e24a0be26fee2f8d863ed025b5c65 Mon Sep 17 00:00:00 2001 From: Mirco Zeiss Date: Wed, 30 Nov 2016 09:51:17 +0100 Subject: [PATCH] select: add disabled property (fix #183) --- components/select/Select.scss | 5 +++ components/select/index.js | 5 ++- components/select/test/test.js | 5 +++ examples/js/components/selectRoute.js | 55 +++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/components/select/Select.scss b/components/select/Select.scss index 0236f6129..08fb4a54e 100644 --- a/components/select/Select.scss +++ b/components/select/Select.scss @@ -34,6 +34,11 @@ outline: 0; } +// https://material.google.com/style/color.html#color-text-background-colors +.Select-body:disabled { + color: rgba(0, 0, 0, 0.38); +} + .Select-placeholder { color: rgba(0, 0, 0, 0.54); } diff --git a/components/select/index.js b/components/select/index.js index 6107e692d..5da207935 100644 --- a/components/select/index.js +++ b/components/select/index.js @@ -18,6 +18,7 @@ const MAX_LIST_LENGTH = 5 export default class Select extends React.Component { static propTypes = { + disabled: React.PropTypes.bool, label: React.PropTypes.string, items: React.PropTypes.array, placeholder: React.PropTypes.string, @@ -79,7 +80,7 @@ export default class Select extends React.Component { } render () { - const {selectedIndex, label} = this.props + const {selectedIndex, label, disabled} = this.props const {open} = this.state const empty = selectedIndex === -1 const text = empty ? this.props.placeholder : this.props.items[selectedIndex] @@ -90,7 +91,7 @@ export default class Select extends React.Component { label && {this.props.label} } -