-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate select-field docs to the new standard
- Loading branch information
Showing
14 changed files
with
474 additions
and
540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
docs/src/app/components/pages/components/SelectField/ExampleCustomLabel.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import SelectField from 'material-ui/lib/SelectField'; | ||
import MenuItem from 'material-ui/lib/menus/menu-item'; | ||
|
||
export default class SelectFieldCustomLabelExample extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = {value: 1}; | ||
} | ||
|
||
handleChange = (e, index, value) => this.setState({value}); | ||
|
||
render() { | ||
return ( | ||
<SelectField value={this.state.value} onChange={this.handleChange}> | ||
<MenuItem value={1} label="5 am - 12 pm" primaryText="Morning"/> | ||
<MenuItem value={2} label="12 pm - 5 pm" primaryText="Afternoon"/> | ||
<MenuItem value={3} label="5 pm to 9 pm" primaryText="Evening"/> | ||
<MenuItem value={4} label="9 pm to 4 am" primaryText="Night"/> | ||
</SelectField> | ||
); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
docs/src/app/components/pages/components/SelectField/ExampleDisabled.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import SelectField from 'material-ui/lib/SelectField'; | ||
import MenuItem from 'material-ui/lib/menus/menu-item'; | ||
|
||
const SelectFieldDisabledExample = () => ( | ||
<SelectField value={1} disabled={true}> | ||
<MenuItem value={1} primaryText="Never"/> | ||
<MenuItem value={2} primaryText="Every Night"/> | ||
</SelectField> | ||
); | ||
|
||
export default SelectFieldDisabledExample; |
48 changes: 48 additions & 0 deletions
48
docs/src/app/components/pages/components/SelectField/ExampleError.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import SelectField from 'material-ui/lib/SelectField'; | ||
import MenuItem from 'material-ui/lib/menus/menu-item'; | ||
|
||
export default class SelectFieldErrorExample extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = {value: null}; | ||
} | ||
|
||
handleChange = (e, index, value) => this.setState({value}); | ||
|
||
render() { | ||
const {value} = this.state; | ||
|
||
const items = [ | ||
<MenuItem key={1} value={1} primaryText="Never"/>, | ||
<MenuItem key={2} value={2} primaryText="Every Night"/>, | ||
<MenuItem key={3} value={3} primaryText="Weeknights"/>, | ||
<MenuItem key={4} value={4} primaryText="Weekends"/>, | ||
<MenuItem key={5} value={5} primaryText="Weekly"/>, | ||
]; | ||
|
||
const night = value === 2 || value === 3; | ||
|
||
return ( | ||
<div> | ||
<SelectField | ||
value={value} | ||
onChange={this.handleChange} | ||
errorText={!night && 'Should be Night'} | ||
> | ||
{items} | ||
</SelectField> | ||
<br/> | ||
<SelectField | ||
value={value} | ||
onChange={this.handleChange} | ||
errorText={night && 'Should not be Night (Custom error style)'} | ||
errorStyle={{color: 'orange'}} | ||
> | ||
{items} | ||
</SelectField> | ||
</div> | ||
); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
docs/src/app/components/pages/components/SelectField/ExampleFloatingLabel.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import SelectField from 'material-ui/lib/SelectField'; | ||
import MenuItem from 'material-ui/lib/menus/menu-item'; | ||
|
||
export default class SelectFieldFloatingLabelExample extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = {value: null}; | ||
} | ||
|
||
handleChange = (e, index, value) => this.setState({value}); | ||
|
||
render() { | ||
|
||
const items = [ | ||
<MenuItem key={1} value={1} primaryText="Never"/>, | ||
<MenuItem key={2} value={2} primaryText="Every Night"/>, | ||
<MenuItem key={3} value={3} primaryText="Weeknights"/>, | ||
<MenuItem key={4} value={4} primaryText="Weekends"/>, | ||
<MenuItem key={5} value={5} primaryText="Weekly"/>, | ||
]; | ||
|
||
return ( | ||
<div> | ||
<SelectField | ||
value={this.state.value} | ||
onChange={this.handleChange} | ||
floatingLabelText="Float Label Text" | ||
> | ||
{items} | ||
</SelectField> | ||
<br/> | ||
<SelectField | ||
value={this.state.value} | ||
onChange={this.handleChange} | ||
floatingLabelText="Custom Float Label Text" | ||
floatingLabelStyle={{color: 'red'}} | ||
> | ||
{items} | ||
</SelectField> | ||
</div> | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
docs/src/app/components/pages/components/SelectField/ExampleSimple.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import SelectField from 'material-ui/lib/SelectField'; | ||
import MenuItem from 'material-ui/lib/menus/menu-item'; | ||
|
||
export default class SelectFieldSimpleExample extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = {value: 2}; | ||
} | ||
|
||
handleChange = (e, index, value) => this.setState({value}); | ||
|
||
render() { | ||
return ( | ||
<SelectField value={this.state.value} onChange={this.handleChange}> | ||
<MenuItem value={1} primaryText="Never"/> | ||
<MenuItem value={2} primaryText="Every Night"/> | ||
<MenuItem value={3} primaryText="Weeknights"/> | ||
<MenuItem value={4} primaryText="Weekends"/> | ||
<MenuItem value={5} primaryText="Weekly"/> | ||
</SelectField> | ||
); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
docs/src/app/components/pages/components/SelectField/Page.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import CodeExample from '../../../CodeExample'; | ||
import PropTypeDescription from '../../../PropTypeDescription'; | ||
import MarkdownElement from '../../../MarkdownElement'; | ||
|
||
import selectFieldReadmeText from './README'; | ||
import SelectFieldSimpleExample from './ExampleSimple'; | ||
import selectFieldSimpleExampleCode from '!raw!./ExampleSimple'; | ||
import SelectFieldDisabledExample from './ExampleDisabled'; | ||
import selectFieldDisabledExampleCode from '!raw!./ExampleDisabled'; | ||
import SelectFieldCustomLabelExample from './ExampleCustomLabel'; | ||
import selectFieldCustomLabelExampleCode from '!raw!./ExampleCustomLabel'; | ||
import SelectFieldFloatingLabelExample from './ExampleFloatingLabel'; | ||
import selectFieldFloatingLabelExampleCode from '!raw!./ExampleFloatingLabel'; | ||
import SelectFieldErrorExample from './ExampleError'; | ||
import selectFieldErrorExampleCode from '!raw!./ExampleError'; | ||
import selectFieldCode from '!raw!material-ui/lib/SelectField/SelectField'; | ||
|
||
const SelectFieldPage = () => ( | ||
<div> | ||
<MarkdownElement text={selectFieldReadmeText} /> | ||
<CodeExample code={selectFieldSimpleExampleCode}> | ||
<SelectFieldSimpleExample /> | ||
</CodeExample> | ||
<CodeExample code={selectFieldDisabledExampleCode}> | ||
<SelectFieldDisabledExample /> | ||
</CodeExample> | ||
<CodeExample code={selectFieldCustomLabelExampleCode}> | ||
<SelectFieldCustomLabelExample /> | ||
</CodeExample> | ||
<CodeExample code={selectFieldFloatingLabelExampleCode}> | ||
<SelectFieldFloatingLabelExample /> | ||
</CodeExample> | ||
<CodeExample code={selectFieldErrorExampleCode}> | ||
<SelectFieldErrorExample /> | ||
</CodeExample> | ||
<PropTypeDescription code={selectFieldCode}/> | ||
</div> | ||
); | ||
|
||
export default SelectFieldPage; |
6 changes: 6 additions & 0 deletions
6
docs/src/app/components/pages/components/SelectField/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Select Field | ||
|
||
To learn more about `SelectField` please visit the specifications | ||
[here](https://www.google.com/design/spec/components/menus.html#menus-usage). | ||
|
||
### Examples |
Oops, something went wrong.