Skip to content

Commit

Permalink
[stepper] Use next.js as per mui#7759 (mui#4799)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhayes committed Oct 2, 2017
1 parent 58b60fe commit 33a8f5f
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles, createStyleSheet } from "material-ui/styles";
import { withStyles } from "material-ui/styles";
import { Step, Stepper, StepLabel, StepButton } from "material-ui/Stepper";
import Button from "material-ui/Button";

const styleSheet = createStyleSheet("HorizontalLabelPositionBelowStepper", theme => ({
const styles = theme => ({
root: {
width: '90%'
},
backButton: {
marginRight: theme.spacing.unit
}
}));
});

class HorizontalLabelPositionBelowStepper extends Component {
state = {
Expand Down Expand Up @@ -96,4 +96,4 @@ HorizontalLabelPositionBelowStepper.propTypes = {
classes: PropTypes.object
};

export default withStyles(styleSheet)(HorizontalLabelPositionBelowStepper);
export default withStyles(styles)(HorizontalLabelPositionBelowStepper);
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,32 @@

import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles, createStyleSheet } from "material-ui/styles";
import { withStyles } from "material-ui/styles";
import { Step, Stepper, StepLabel } from "material-ui/Stepper";
import Button from "material-ui/Button";

const styleSheet = createStyleSheet("HorizontalLinearStepper", theme => ({
const styles = theme => ({
root: {
width: '90%'
},
button: {
marginRight: theme.spacing.unit
}
}));
});


class HorizontalLinearStepper extends Component {

static propTypes = {
classes: PropTypes.object
}

state = {
activeStep: 0,
skipped: new Set(),
};


isStepOptional(step) {
return step === 1;
}
Expand Down Expand Up @@ -139,8 +145,4 @@ class HorizontalLinearStepper extends Component {
}
}

HorizontalLinearStepper.propTypes = {
classes: PropTypes.object
};

export default withStyles(styleSheet)(HorizontalLinearStepper);
export default withStyles(styles)(HorizontalLinearStepper);
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles, createStyleSheet } from "material-ui/styles";
import { withStyles } from "material-ui/styles";
import { Step, Stepper, StepLabel, StepButton } from "material-ui/Stepper";
import Button from "material-ui/Button";
import Typography from "material-ui/Typography";

const styleSheet = createStyleSheet("HorizontalLabelPositionBelowStepper", theme => ({
const styles = theme => ({
root: {
width: '90%'
},
Expand All @@ -20,7 +20,7 @@ const styleSheet = createStyleSheet("HorizontalLabelPositionBelowStepper", theme
completed: {
display: 'inline-block',
},
}));
});

class HorizontalNonLinearAlternativeLabelStepper extends Component {
state = {
Expand Down Expand Up @@ -207,4 +207,4 @@ HorizontalNonLinearAlternativeLabelStepper.propTypes = {
classes: PropTypes.object
};

export default withStyles(styleSheet)(HorizontalNonLinearAlternativeLabelStepper);
export default withStyles(styles)(HorizontalNonLinearAlternativeLabelStepper);
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles, createStyleSheet } from "material-ui/styles";
import { withStyles } from "material-ui/styles";
import { Step, Stepper, StepLabel, StepButton } from "material-ui/Stepper";
import Button from "material-ui/Button";
import Typography from "material-ui/Typography";

const styleSheet = createStyleSheet("HorizontalNonLinearStepper", theme => ({
const styles = theme => ({
root: {
width: '90%'
},
Expand All @@ -17,7 +17,7 @@ const styleSheet = createStyleSheet("HorizontalNonLinearStepper", theme => ({
completed: {
display: 'inline-block',
},
}));
});

class HorizontalNonLinearStepper extends Component {
state = {
Expand Down Expand Up @@ -155,4 +155,4 @@ HorizontalNonLinearStepper.propTypes = {
classes: PropTypes.object
};

export default withStyles(styleSheet)(HorizontalNonLinearStepper);
export default withStyles(styles)(HorizontalNonLinearStepper);
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import React, { Component } from "react";
import PropTypes from "prop-types";
import { withStyles, createStyleSheet } from "material-ui/styles";
import { withStyles } from "material-ui/styles";
import { Step, Stepper, StepLabel, StepContent } from "material-ui/Stepper";
import Button from "material-ui/Button";
import Paper from "material-ui/Paper";
import Typography from "material-ui/Typography";

const styleSheet = createStyleSheet("VerticalLinearStepper", theme => ({
const styles = theme => ({
root: {
width: '90%'
},
Expand All @@ -22,7 +22,7 @@ const styleSheet = createStyleSheet("VerticalLinearStepper", theme => ({
marginTop: 0,
padding: theme.spacing.unit * 3, // TODO: See TODO note on Stepper
},
}));
});

class VerticalLinearStepper extends Component {
state = {
Expand Down Expand Up @@ -111,4 +111,4 @@ VerticalLinearStepper.propTypes = {
classes: PropTypes.object
};

export default withStyles(styleSheet)(VerticalLinearStepper);
export default withStyles(styles)(VerticalLinearStepper);
10 changes: 5 additions & 5 deletions docs/src/pages/demos/stepper/stepper.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The `<Stepper>` can be controlled by passing the current step index (zero based)

This example also shows the use of an optional step by placing the `optional` prop on the second `<Step>` component. Note that it's up to you to manage when an optional step is skipped. Once you've determined this for a particular step you must set `completed={false}` to signify that even though the active step index has gone beyond the optional step, it's not actually complete.

{{demo='pages/component-demos/stepper/HorizontalLinearStepper.js'}}
{{demo='pages/demos/stepper/HorizontalLinearStepper.js'}}


## Horizontal Non Linear
Expand All @@ -45,24 +45,24 @@ We've used the `<StepButton>` here to demonstrate clickable step labels as well
flag however because steps can be accessed in a non-linear fashion it's up to your own implementation to
determine when all steps are completed (or even if they need to be completed).

{{demo='pages/component-demos/stepper/HorizontalNonLinearStepper.js'}}
{{demo='pages/demos/stepper/HorizontalNonLinearStepper.js'}}


## Horizontal Linear - Alternative Label

Labels can be placed below the step icon by setting the `alternativeLabel` prop on the `<Stepper>` component.

{{demo='pages/component-demos/stepper/HorizontalLinearAlternativeLabelStepper.js'}}
{{demo='pages/demos/stepper/HorizontalLinearAlternativeLabelStepper.js'}}


## Horizontal Non Linear - Alternative Label

{{demo='pages/component-demos/stepper/HorizontalNonLinearAlternativeLabelStepper.js'}}
{{demo='pages/demos/stepper/HorizontalNonLinearAlternativeLabelStepper.js'}}


## Vertical Stepper

{{demo='pages/component-demos/stepper/VerticalLinearStepper.js'}}
{{demo='pages/demos/stepper/VerticalLinearStepper.js'}}

## Mobile Stepper

Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/getting-started/supported-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ to discuss the approach before submitting a PR.
- **[Grid](https://material.io/guidelines/components/subheaders.html#subheaders-list-subheaders)**
- [Menu](https://material.io/guidelines/components/subheaders.html#subheaders-list-subheaders)
- [Steppers](https://material.io/guidelines/components/steppers.html)
- [Horizontal](https://material.io/guidelines/components/steppers.html#steppers-types-of-steppers)
- [Vertical](https://material.io/guidelines/components/steppers.html#steppers-types-of-steppers)
- **[Horizontal](https://material.io/guidelines/components/steppers.html#steppers-types-of-steppers)**
- **[Vertical](https://material.io/guidelines/components/steppers.html#steppers-types-of-steppers)**
- **[Mobile steps](https://material.io/guidelines/components/steppers.html#steppers-types-of-steps)**
- **[Tabs](https://material.io/guidelines/components/tabs.html)**
- Usage
Expand Down
35 changes: 35 additions & 0 deletions pages/demos/stepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,41 @@ function Page() {
<MarkdownDocs
markdown={markdown}
demos={{
'pages/demos/stepper/HorizontalLinearAlternativeLabelStepper.js': {
js: require('docs/src/pages/demos/stepper/HorizontalLinearAlternativeLabelStepper').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/stepper/HorizontalLinearAlternativeLabelStepper'), 'utf8')
`,
},
'pages/demos/stepper/HorizontalLinearStepper.js': {
js: require('docs/src/pages/demos/stepper/HorizontalLinearStepper').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/stepper/HorizontalLinearStepper'), 'utf8')
`,
},
'pages/demos/stepper/HorizontalNonLinearAlternativeLabelStepper.js': {
js: require('docs/src/pages/demos/stepper/HorizontalNonLinearAlternativeLabelStepper').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/stepper/HorizontalNonLinearAlternativeLabelStepper'), 'utf8')
`,
},
'pages/demos/stepper/HorizontalNonLinearStepper.js': {
js: require('docs/src/pages/demos/stepper/HorizontalNonLinearStepper').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/stepper/HorizontalNonLinearStepper'), 'utf8')
`,
},
'pages/demos/stepper/VerticalLinearStepper.js': {
js: require('docs/src/pages/demos/stepper/VerticalLinearStepper').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/stepper/VerticalLinearStepper'), 'utf8')
`,
},
'pages/demos/stepper/TextMobileStepper.js': {
js: require('docs/src/pages/demos/stepper/TextMobileStepper').default,
raw: preval`
Expand Down

0 comments on commit 33a8f5f

Please sign in to comment.