Skip to content

Commit

Permalink
Merge pull request #2798 from Zadielerick/progressDocsUpdate
Browse files Browse the repository at this point in the history
[Docs] Update Documentation for Progress
  • Loading branch information
oliviertassinari committed Jan 6, 2016
2 parents a3997eb + 3374ba0 commit 45923ba
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 158 deletions.
6 changes: 4 additions & 2 deletions docs/src/app/app-routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ 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 CircularProgressPage from './components/pages/components/CircularProgress/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';
Expand All @@ -35,10 +36,10 @@ import IconButtonPage from './components/pages/components/IconButton/Page';
import IconMenus from './components/pages/components/icon-menus';
import LeftNavPage from './components/pages/components/LeftNav/Page';
import ListPage from './components/pages/components/List/Page';
import LinearProgressPage from './components/pages/components/LinearProgress/Page';
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 RefreshIndicatorPage from './components/pages/components/RefreshIndicator/Page';
import SelectField from './components/pages/components/SelectField/Page';
import Sliders from './components/pages/components/sliders';
Expand Down Expand Up @@ -87,6 +88,7 @@ const AppRoutes = (
<Route path="badge" component={BadgePage} />
<Route path="buttons" component={Buttons} />
<Route path="card" component={CardPage} />
<Route path="circular-progress" component={CircularProgressPage} />
<Route path="date-picker" component={DatePicker} />
<Route path="dialog" component={DialogPage} />
<Route path="divider" component={DividerPage} />
Expand All @@ -97,10 +99,10 @@ const AppRoutes = (
<Route path="icon-menus" component={IconMenus} />
<Route path="left-nav" component={LeftNavPage} />
<Route path="list" component={ListPage} />
<Route path="linear-progress" component={LinearProgressPage} />
<Route path="menus" component={Menus} />
<Route path="paper" component={Paper} />
<Route path="popover" component={Popover} />
<Route path="progress" component={Progress} />
<Route path="refresh-indicator" component={RefreshIndicatorPage} />
<Route path="select-field" component={SelectField} />
<Route path="sliders" component={Sliders} />
Expand Down
20 changes: 15 additions & 5 deletions docs/src/app/components/app-left-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,22 @@ const AppLeftNav = React.createClass({
primaryText="Popover"
/>,
<ListItem
value="/components/progress"
primaryText="Progress"
/>,
<ListItem
value="/components/refresh-indicator"
primaryText="Refresh Indicator"
primaryTogglesNestedList={true}
nestedItems={[
<ListItem
value="/components/circular-progress"
primaryText="Circular Progress"
/>,
<ListItem
value="/components/linear-progress"
primaryText="Linear Progress"
/>,
<ListItem
value="/components/refresh-indicator"
primaryText="Refresh Indicator"
/>,
]}
/>,
<ListItem
value="/components/select-field"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import CircularProgress from 'material-ui/lib/circular-progress';

export default class CircularProgressExampleDeterminate extends React.Component {

constructor(props) {
super(props);

this.state = {
completed: 0,
};
}

componentDidMount() {
this.timer = setTimeout(() => this.progress(5), 1000);
}

componentWillUnmount() {
clearTimeout(this.timer);
}

progress(completed) {
if (completed > 100) {
this.setState({completed: 100});
} else {
this.setState({completed});
const diff = Math.random() * 10;
this.timer = setTimeout(() => this.progress(completed + diff), 1000);
}
}

render() {
return (
<div>
<CircularProgress mode="determinate" value={this.state.completed}/>
<CircularProgress mode="determinate" value={this.state.completed} size={1.5}/>
<CircularProgress mode="determinate" value={this.state.completed} size={2}/>
</div>
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import CircularProgress from 'material-ui/lib/circular-progress';

const CircularProgressExampleSimple = () => (
<div>
<CircularProgress mode="indeterminate" />
<CircularProgress mode="indeterminate" size={1.5}/>
<CircularProgress mode="indeterminate" size={2}/>
</div>
);

export default CircularProgressExampleSimple;
26 changes: 26 additions & 0 deletions docs/src/app/components/pages/components/CircularProgress/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 circleProgressReadmeText from './README';
import circleProgressCode from '!raw!material-ui/lib/circular-progress';
import CircleProgressExampleSimple from './ExampleSimple';
import circleProgressExampleSimpleCode from '!raw!./ExampleSimple';
import CircleProgressExampleDeterminate from './ExampleDeterminate';
import circleProgressExampleDeterminateCode from '!raw!./ExampleDeterminate';

const CircleProgressPage = () => (
<div>
<MarkdownElement text={circleProgressReadmeText} />
<CodeExample code={circleProgressExampleSimpleCode}>
<CircleProgressExampleSimple />
</CodeExample>
<CodeExample code={circleProgressExampleDeterminateCode}>
<CircleProgressExampleDeterminate />
</CodeExample>
<PropTypeDescription code={circleProgressCode}/>
</div>
);

export default CircleProgressPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Circular Progress
[Circular Progress](https://www.google.com/design/spec/components/progress-activity.html#progress-activity-types-of-indicators)
will rotate to show the progress of a task or that there is a wait for a task to complete.

### Examples
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import LinearProgress from 'material-ui/lib/linear-progress';

export default class LinearProgressExampleDeterminate extends React.Component {

constructor(props) {
super(props);

this.state = {
completed: 0,
};
}

componentDidMount() {
this.timer = setTimeout(() => this.progress(5), 1000);
}

componentWillUnmount() {
clearTimeout(this.timer);
}

progress(completed) {
if (completed > 100) {
this.setState({completed: 100});
} else {
this.setState({completed});
const diff = Math.random() * 10;
this.timer = setTimeout(() => this.progress(completed + diff), 1000);
}
}

render() {
return (
<LinearProgress mode="determinate" value={this.state.completed} />
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import LinearProgress from 'material-ui/lib/linear-progress';

const LinearProgressExampleSimple = () => (
<LinearProgress mode="indeterminate"/>
);

export default LinearProgressExampleSimple;
26 changes: 26 additions & 0 deletions docs/src/app/components/pages/components/LinearProgress/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 linearProgressReadmeText from './README';
import linearProgressCode from '!raw!material-ui/lib/linear-progress';
import LinearProgressExampleSimple from './ExampleSimple';
import linearProgressExampleSimpleCode from '!raw!./ExampleSimple';
import LinearProgressExampleDeterminate from './ExampleDeterminate';
import linearProgressExampleDeterminateCode from '!raw!./ExampleDeterminate';

const LinearProgressPage = () => (
<div>
<MarkdownElement text={linearProgressReadmeText} />
<CodeExample code={linearProgressExampleSimpleCode}>
<LinearProgressExampleSimple />
</CodeExample>
<CodeExample code={linearProgressExampleDeterminateCode}>
<LinearProgressExampleDeterminate />
</CodeExample>
<PropTypeDescription code={linearProgressCode}/>
</div>
);

export default LinearProgressPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Linear Progress
[Linear Progress](https://www.google.com/design/spec/components/progress-activity.html#progress-activity-types-of-indicators)
bars fill from 0% to 100% to show the progress of a task. It also will animate to
show there is a task waiting to be done.

### Examples
139 changes: 0 additions & 139 deletions docs/src/app/components/pages/components/progress.jsx

This file was deleted.

12 changes: 0 additions & 12 deletions docs/src/app/components/raw-code/progress-code.txt

This file was deleted.

Loading

0 comments on commit 45923ba

Please sign in to comment.