Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Documentation for Buttons #2745

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/src/app/app-routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ import AppBarPage from './components/pages/components/AppBar/Page';
import AutoComplete from './components/pages/components/auto-complete';
import AvatarPage from './components/pages/components/Avatar/Page';
import BadgePage from './components/pages/components/Badge/Page';
import Buttons from './components/pages/components/buttons';
import CardPage from './components/pages/components/Card/Page';
import DatePicker from './components/pages/components/DatePicker/Page';
import DialogPage from './components/pages/components/Dialog/Page';
import DividerPage from './components/pages/components/Divider/Page';
import DropDownMenuPage from './components/pages/components/DropDownMenu/Page';
import FlatButtonPage from './components/pages/components/FlatButton/Page';
import FloatingActionButtonPage from './components/pages/components/FloatingActionButton/Page';
import GridListPage from './components/pages/components/GridList/Page';
import Icons from './components/pages/components/icons';
import IconButtonPage from './components/pages/components/IconButton/Page';
Expand All @@ -39,6 +40,7 @@ import Menus from './components/pages/components/menus';
import Paper from './components/pages/components/paper';
import Popover from './components/pages/components/popover';
import Progress from './components/pages/components/progress';
import RaisedButtonPage from './components/pages/components/RaisedButton/Page';
import RefreshIndicator from './components/pages/components/refresh-indicator';
import SelectField from './components/pages/components/SelectField/Page';
import Sliders from './components/pages/components/sliders';
Expand Down Expand Up @@ -84,12 +86,13 @@ const AppRoutes = (
<Route path="auto-complete" component={AutoComplete} />
<Route path="avatar" component={AvatarPage} />
<Route path="badge" component={BadgePage} />
<Route path="buttons" component={Buttons} />
<Route path="card" component={CardPage} />
<Route path="date-picker" component={DatePicker} />
<Route path="dialog" component={DialogPage} />
<Route path="divider" component={DividerPage} />
<Route path="dropdown-menu" component={DropDownMenuPage} />
<Route path="flat-button" component={FlatButtonPage} />
<Route path="floating-action-button" component={FloatingActionButtonPage} />
<Route path="grid-list" component={GridListPage} />
<Route path="icons" component={Icons} />
<Route path="icon-button" component={IconButtonPage} />
Expand All @@ -100,6 +103,7 @@ const AppRoutes = (
<Route path="paper" component={Paper} />
<Route path="popover" component={Popover} />
<Route path="progress" component={Progress} />
<Route path="raised-button" component={RaisedButtonPage} />
<Route path="refresh-indicator" component={RefreshIndicator} />
<Route path="select-field" component={SelectField} />
<Route path="sliders" component={Sliders} />
Expand Down
16 changes: 15 additions & 1 deletion docs/src/app/components/app-left-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,22 @@ const AppLeftNav = React.createClass({
primaryText="Badge"
/>,
<ListItem
value="/components/buttons"
primaryText="Buttons"
primaryTogglesNestedList={true}
nestedItems={[
<ListItem
value="/components/flat-button"
primaryText="Flat Button"
/>,
<ListItem
value="/components/raised-button"
primaryText="Raised Button"
/>,
<ListItem
value="/components/floating-action-button"
primaryText="Floating Action Button"
/>,
]}
/>,
<ListItem
value="/components/card"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import FlatButton from 'material-ui/lib/flat-button';
import Colors from 'material-ui/lib/styles/colors';
import FontIcon from 'material-ui/lib/font-icon';

const styles = {
buttonLabel: {
padding: '0px 16px 0px 8px',
},
exampleImageInput: {
cursor: 'pointer',
position: 'absolute',
top: 0,
bottom: 0,
right: 0,
left: 0,
width: '100%',
opacity: 0,
},
exampleFlatButtonIcon: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this style be handled by the FlatButton component?

color: Colors.cyan500,
},
};

const FlatButtonExampleComplex = () => (
<div>
<FlatButton primary={true} label="Choose an Image">
<input type="file" id="imageButton" style={styles.exampleImageInput}></input>
</FlatButton>
<FlatButton
linkButton={true}
href="https://github.com/callemall/material-ui"
secondary={true}
label="GitHub"
labelStyle={styles.buttonLabel}>
<FontIcon style={styles.exampleFlatButtonIcon} className="muidocs-icon-custom-github"/>
</FlatButton>
<FlatButton
secondary={true}
label="Label after"
labelPosition="after"
labelStyle={styles.buttonLabel}>
<FontIcon style={styles.exampleFlatButtonIcon} className="muidocs-icon-custom-github"/>
</FlatButton>
<FlatButton label="Disabled" disabled={true} />
</div>
);

export default FlatButtonExampleComplex;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import FlatButton from 'material-ui/lib/flat-button';

const FlatButtonExampleSimple = () => (
<div>
<FlatButton label="Default" />
<FlatButton label="Primary" primary={true} />
<FlatButton label="Secondary" secondary={true} />
</div>
);

export default FlatButtonExampleSimple;
26 changes: 26 additions & 0 deletions docs/src/app/components/pages/components/FlatButton/Page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';

import flatButtonCode from '!raw!material-ui/lib/flat-button';
import flatButtonReadmeText from './README';
import flatButtonExampleSimpleCode from '!raw!./ExampleSimple';
import FlatButtonExampleSimple from './ExampleSimple';
import flatButtonExampleComplexCode from '!raw!./ExampleComplex';
import FlatButtonExampleComplex from './ExampleComplex';

const FlatButtonPage = () => (
<div>
<MarkdownElement text={flatButtonReadmeText}/>
<CodeExample code={flatButtonExampleSimpleCode}>
<FlatButtonExampleSimple />
</CodeExample>
<CodeExample code={flatButtonExampleComplexCode}>
<FlatButtonExampleComplex />
</CodeExample>
<PropTypeDescription code={flatButtonCode}/>
</div>
);

export default FlatButtonPage;
5 changes: 5 additions & 0 deletions docs/src/app/components/pages/components/FlatButton/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Flat Button
[Flat Buttons](https://www.google.com/design/spec/components/buttons.html#buttons-flat-raised-buttons)
are used for general functions and reduce the amount of layering on the screen, making it more readable.

### Examples
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import FloatingActionButton from 'material-ui/lib/floating-action-button';
import Add from 'material-ui/lib/svg-icons/content/add';

const style = {
marginRight: 20,
};

const FloatingButtonExampleComplex = () => (
<div>
<FloatingActionButton secondary={true} style={style}>
<Add/>
</FloatingActionButton>
<FloatingActionButton mini={true} secondary={true} style={style}>
<Add />
</FloatingActionButton>
<FloatingActionButton
disabled={true}
style={style}>
<Add/>
</FloatingActionButton>
<FloatingActionButton
mini={true}
disabled={true}
style={style}>
<Add/>
</FloatingActionButton>
</div>
);

export default FloatingButtonExampleComplex;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import FloatingActionButton from 'material-ui/lib/floating-action-button';
import Add from 'material-ui/lib/svg-icons/content/add';

const style = {
marginRight: 20,
};

const FloatingActionButtonExampleSimple = () => (
<div>
<FloatingActionButton style={style}>
<Add/>
</FloatingActionButton>
<FloatingActionButton mini={true} style={style}>
<Add/>
</FloatingActionButton>
</div>
);

export default FloatingActionButtonExampleSimple;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';

import floatingButtonCode from '!raw!material-ui/lib/floating-action-button';
import floatingButtonReadmeText from './README';
import floatingButtonExampleSimpleCode from '!raw!./ExampleSimple';
import FloatingButtonExampleSimple from './ExampleSimple';
import floatingButtonExampleComplexCode from '!raw!./ExampleComplex';
import FloatingButtonExampleComplex from './ExampleComplex';

const FloatingActionButtonPage = () => (
<div>
<MarkdownElement text={floatingButtonReadmeText}/>
<CodeExample code={floatingButtonExampleSimpleCode}>
<FloatingButtonExampleSimple />
</CodeExample>
<CodeExample code={floatingButtonExampleComplexCode}>
<FloatingButtonExampleComplex />
</CodeExample>
<PropTypeDescription code={floatingButtonCode}/>
</div>
);

export default FloatingActionButtonPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Floating Action Button
The [Floating Action Button](https://www.google.com/design/spec/components/buttons-floating-action-button.html)
is used for frequently used functions.

### Examples
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from 'react';
import RaisedButton from 'material-ui/lib/raised-button';
import FontIcon from 'material-ui/lib/font-icon';
import Typography from 'material-ui/lib/styles/typography';

const style = {
buttonLabel: {
padding: '0px 16px 0px 8px',
},
exampleImageInput: {
cursor: 'pointer',
position: 'absolute',
top: 0,
bottom: 0,
right: 0,
left: 0,
width: '100%',
opacity: 0,
},
exampleButtonIcon: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this style be handled by the RaisedButton component?

color: Typography.textFullWhite,
},
button: {
margin: 12,
},
};

const RaisedButtonExampleComplex = () => (
<div>
<RaisedButton primary={true} label="Choose an Image" style={style.button}>
<input type="file" style={style.exampleImageInput}></input>
</RaisedButton>
<RaisedButton
linkButton={true}
href="https://github.com/callemall/material-ui"
secondary={true}
style={style.button}
label="Github"
labelStyle={style.buttonLabel}>
<FontIcon style={style.exampleButtonIcon} className="muidocs-icon-custom-github"/>
</RaisedButton>
<RaisedButton
secondary={true}
label="Label after"
labelPosition="after"
labelStyle={style.buttonLabel}
style={style.button}>
<FontIcon style={style.exampleButtonIcon} className="muidocs-icon-custom-github"/>
</RaisedButton>
<RaisedButton label="Disabled" disabled={true} style={style.button}/>
</div>
);

export default RaisedButtonExampleComplex;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import RaisedButton from 'material-ui/lib/raised-button';

const style = {
margin: 12,
};

const RaisedButtonExampleSimple = () => (
<div>
<RaisedButton label="Default" style={style} />
<RaisedButton label="Primary" primary={true} style={style} />
<RaisedButton label="Secondary" secondary={true} style={style} />
</div>
);

export default RaisedButtonExampleSimple;
26 changes: 26 additions & 0 deletions docs/src/app/components/pages/components/RaisedButton/Page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';

import raisedButtonCode from '!raw!material-ui/lib/raised-button';
import raisedButtonReadmeText from './README';
import raisedButtonExampleSimpleCode from '!raw!./ExampleSimple';
import RaisedButtonExampleSimple from './ExampleSimple';
import RaisedButtonExampleComplexCode from '!raw!./ExampleComplex';
import RaisedButtonExampleComplex from './ExampleComplex';

const FloatingActionButtonPage = () => (
<div>
<MarkdownElement text={raisedButtonReadmeText}/>
<CodeExample code={raisedButtonExampleSimpleCode}>
<RaisedButtonExampleSimple />
</CodeExample>
<CodeExample code={RaisedButtonExampleComplexCode}>
<RaisedButtonExampleComplex />
</CodeExample>
<PropTypeDescription code={raisedButtonCode}/>
</div>
);

export default FloatingActionButtonPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raised Button
This [button](https://www.google.com/design/spec/components/buttons.html#buttons-flat-raised-buttons)
is used to add dimension to mostly flat layouts and emphasizes important functions on your page.

### Examples
Loading