Skip to content

Commit

Permalink
[stepper] Linting fixes. (mui#4799)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhayes committed Oct 8, 2017
1 parent 4ba2dee commit 6c8a8a1
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ class HorizontalLabelPositionBelowStepper extends Component {
};

handleNext = () => {
const { activeStep } = this.state;
this.setState({
activeStep: this.state.activeStep + 1,
activeStep: activeStep + 1,
});
};

handleBack = () => {
const { activeStep } = this.state;
this.setState({
activeStep: this.state.activeStep - 1,
activeStep: activeStep - 1,
});
};

Expand Down Expand Up @@ -62,9 +64,9 @@ class HorizontalLabelPositionBelowStepper extends Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
const steps = this.getSteps();
const activeStep = this.state.activeStep;
const { activeStep } = this.state;
let stepKey = 0;

return (
Expand All @@ -82,12 +84,16 @@ class HorizontalLabelPositionBelowStepper extends Component {
<div>
{this.state.activeStep === steps.length ? (
<div>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Typography className={classes.instructions}>
All steps completed - you&quot;re finished
</Typography>
<Button onClick={this.handleReset}>Reset</Button>
</div>
) : (
<div>
<Typography className={classes.instructions}>{this.getStepContent(activeStep)}</Typography>
<Typography className={classes.instructions}>
{this.getStepContent(activeStep)}
</Typography>
<div>
<Button
disabled={activeStep === 0}
Expand Down
23 changes: 14 additions & 9 deletions docs/src/pages/demos/stepper/HorizontalLinearStepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,27 @@ class HorizontalLinearStepper extends Component {
}

handleNext = () => {
const activeStep = this.state.activeStep;
let skipped = this.state.skipped;
const { activeStep } = this.state;
let { skipped } = this.state;
if (this.isStepSkipped(activeStep)) {
skipped = new Set(skipped.values());
skipped.delete(activeStep);
}
this.setState({
activeStep: this.state.activeStep + 1,
activeStep: activeStep + 1,
skipped,
});
};

handleBack = () => {
const { activeStep } = this.state;
this.setState({
activeStep: this.state.activeStep - 1,
activeStep: activeStep - 1,
});
};

handleSkip = () => {
const activeStep = this.state.activeStep;
const { activeStep } = this.state;
if (!this.isStepOptional(activeStep)) {
// You probably want to guard against something like this,
// it should never occur unless someone's actively trying to break something.
Expand Down Expand Up @@ -96,9 +97,9 @@ class HorizontalLinearStepper extends Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
const steps = this.getSteps();
const activeStep = this.state.activeStep;
const { activeStep } = this.state;

let stepKey = 0;

Expand All @@ -124,14 +125,18 @@ class HorizontalLinearStepper extends Component {
<div>
{activeStep === steps.length ? (
<div>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Typography className={classes.instructions}>
All steps completed - you&quot;re finished
</Typography>
<Button onClick={this.handleReset} className={classes.button}>
Reset
</Button>
</div>
) : (
<div>
<Typography className={classes.instructions}>{this.getStepContent(activeStep)}</Typography>
<Typography className={classes.instructions}>
{this.getStepContent(activeStep)}
</Typography>
<div>
<Button
disabled={activeStep === 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const styles = theme => ({
instructions: {
marginTop: theme.spacing.unit,
marginBottom: theme.spacing.unit,
}
},
});

class HorizontalNonLinearAlternativeLabelStepper extends Component {
Expand Down Expand Up @@ -62,7 +62,7 @@ class HorizontalNonLinearAlternativeLabelStepper extends Component {
}

handleSkip = () => {
const activeStep = this.state.activeStep;
const { activeStep } = this.state;
if (!this.isStepOptional(activeStep)) {
// You probably want to guard against something like this
// it should never occur unless someone's actively trying to break something.
Expand Down Expand Up @@ -150,9 +150,9 @@ class HorizontalNonLinearAlternativeLabelStepper extends Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
const steps = this.getSteps();
const activeStep = this.state.activeStep;
const { activeStep } = this.state;

let stepKey = 0;

Expand Down Expand Up @@ -180,12 +180,16 @@ class HorizontalNonLinearAlternativeLabelStepper extends Component {
<div>
{this.allStepsCompleted() ? (
<div>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Typography className={classes.instructions}>
All steps completed - you&quot;re finished
</Typography>
<Button onClick={this.handleReset}>Reset</Button>
</div>
) : (
<div>
<Typography className={classes.instructions}>{this.getStepContent(activeStep)}</Typography>
<Typography className={classes.instructions}>
{this.getStepContent(activeStep)}
</Typography>
<div>
<Button
disabled={activeStep === 0}
Expand Down
17 changes: 11 additions & 6 deletions docs/src/pages/demos/stepper/HorizontalNonLinearStepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ class HorizontalNonLinearStepper extends Component {
};

handleBack = () => {
const { activeStep } = this.state;
this.setState({
activeStep: this.state.activeStep - 1,
activeStep: activeStep - 1,
});
};

Expand All @@ -74,7 +75,7 @@ class HorizontalNonLinearStepper extends Component {
};

handleComplete = () => {
const completed = this.state.completed;
const { completed } = this.state;
completed[this.state.activeStep] = true;
this.setState({
completed,
Expand Down Expand Up @@ -107,9 +108,9 @@ class HorizontalNonLinearStepper extends Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
const steps = this.getSteps();
const activeStep = this.state.activeStep;
const { activeStep } = this.state;
let stepKey = 0;

return (
Expand All @@ -129,12 +130,16 @@ class HorizontalNonLinearStepper extends Component {
<div>
{this.allStepsCompleted() ? (
<div>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Typography className={classes.instructions}>
All steps completed - you&quot;re finished
</Typography>
<Button onClick={this.handleReset}>Reset</Button>
</div>
) : (
<div>
<Typography className={classes.instructions}>{this.getStepContent(activeStep)}</Typography>
<Typography className={classes.instructions}>
{this.getStepContent(activeStep)}
</Typography>
<div>
<Button
disabled={activeStep === 0}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/demos/stepper/VerticalLinearStepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class VerticalLinearStepper extends Component {
};

render() {
const classes = this.props.classes;
const { classes } = this.props;
const steps = this.getSteps();
const activeStep = this.state.activeStep;
const { activeStep } = this.state;
let stepKey = 0;

return (
Expand Down
1 change: 0 additions & 1 deletion src/Stepper/StepPositionIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import SvgIcon from '../SvgIcon';
import type { Icon } from './StepButton';
import Typography from '../Typography';

export const styles = (theme: Object) => ({
root: {
Expand Down

0 comments on commit 6c8a8a1

Please sign in to comment.