Skip to content

Commit

Permalink
[stepper] Instructions on demos now use Typography component. (mui#4799)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhayes committed Oct 8, 2017
1 parent 8c64536 commit 9fd3556
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import { Step, Stepper, StepLabel } from 'material-ui/Stepper';
import Button from 'material-ui/Button';
import Typography from 'material-ui/Typography';

const styles = theme => ({
root: {
Expand All @@ -13,6 +14,10 @@ const styles = theme => ({
backButton: {
marginRight: theme.spacing.unit,
},
instructions: {
marginTop: theme.spacing.unit,
marginBottom: theme.spacing.unit,
},
});

class HorizontalLabelPositionBelowStepper extends Component {
Expand Down Expand Up @@ -77,12 +82,12 @@ class HorizontalLabelPositionBelowStepper extends Component {
<div>
{this.state.activeStep === steps.length ? (
<div>
<p>All steps completed - you&quot;re finished</p>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Button onClick={this.handleReset}>Reset</Button>
</div>
) : (
<div>
<p>{this.getStepContent(activeStep)}</p>
<Typography className={classes.instructions}>{this.getStepContent(activeStep)}</Typography>
<div>
<Button
disabled={activeStep === 0}
Expand Down
9 changes: 7 additions & 2 deletions docs/src/pages/demos/stepper/HorizontalLinearStepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import { Step, Stepper, StepLabel } from 'material-ui/Stepper';
import Button from 'material-ui/Button';
import Typography from 'material-ui/Typography';

const styles = theme => ({
root: {
Expand All @@ -13,6 +14,10 @@ const styles = theme => ({
button: {
marginRight: theme.spacing.unit,
},
instructions: {
marginTop: theme.spacing.unit,
marginBottom: theme.spacing.unit,
},
});

class HorizontalLinearStepper extends Component {
Expand Down Expand Up @@ -119,14 +124,14 @@ class HorizontalLinearStepper extends Component {
<div>
{activeStep === steps.length ? (
<div>
<p>All steps completed - you&quot;re finished</p>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Button onClick={this.handleReset} className={classes.button}>
Reset
</Button>
</div>
) : (
<div>
<p>{this.getStepContent(activeStep)}</p>
<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 @@ -20,6 +20,10 @@ const styles = theme => ({
completed: {
display: 'inline-block',
},
instructions: {
marginTop: theme.spacing.unit,
marginBottom: theme.spacing.unit,
}
});

class HorizontalNonLinearAlternativeLabelStepper extends Component {
Expand Down Expand Up @@ -111,8 +115,8 @@ class HorizontalNonLinearAlternativeLabelStepper extends Component {
completed,
});
/**
* Sigh... it would be much nicer to replace the following if conditional with
* `if (!this.allStepsComplete())` however state is not set when we do this,
* Sigh... it would be much nicer to replace the following if conditional with
* `if (!this.allStepsComplete())` however state is not set when we do this,
* thus we have to resort to not being very DRY.
*/
if (completed.size !== this.totalSteps() - this.skippedSteps()) {
Expand Down Expand Up @@ -176,12 +180,12 @@ class HorizontalNonLinearAlternativeLabelStepper extends Component {
<div>
{this.allStepsCompleted() ? (
<div>
<p>All steps completed - you&quot;re finished</p>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Button onClick={this.handleReset}>Reset</Button>
</div>
) : (
<div>
<p>{this.getStepContent(activeStep)}</p>
<Typography className={classes.instructions}>{this.getStepContent(activeStep)}</Typography>
<div>
<Button
disabled={activeStep === 0}
Expand Down
8 changes: 6 additions & 2 deletions docs/src/pages/demos/stepper/HorizontalNonLinearStepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const styles = theme => ({
completed: {
display: 'inline-block',
},
instructions: {
marginTop: theme.spacing.unit,
marginBottom: theme.spacing.unit,
},
});

class HorizontalNonLinearStepper extends Component {
Expand Down Expand Up @@ -125,12 +129,12 @@ class HorizontalNonLinearStepper extends Component {
<div>
{this.allStepsCompleted() ? (
<div>
<p>All steps completed - you&quot;re finished</p>
<Typography className={classes.instructions}>All steps completed - you&quot;re finished</Typography>
<Button onClick={this.handleReset}>Reset</Button>
</div>
) : (
<div>
<p>{this.getStepContent(activeStep)}</p>
<Typography className={classes.instructions}>{this.getStepContent(activeStep)}</Typography>
<div>
<Button
disabled={activeStep === 0}
Expand Down

0 comments on commit 9fd3556

Please sign in to comment.