-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Stepper] Mobile version #7043
[Stepper] Mobile version #7043
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, thanks a lot for working on that! 🙏 💯
That's a first quite review. I need to spend more time on it
@@ -96,6 +96,7 @@ to discuss the approach before submitting a PR. | |||
- [Steppers](https://www.google.com/design/spec/components/steppers.html) | |||
- [Horizontal](https://www.google.com/design/spec/components/steppers.html#steppers-types-of-steppers) | |||
- [Vertical](https://www.google.com/design/spec/components/steppers.html#steppers-types-of-steppers) | |||
- [MobileStepper](https://www.google.com/design/spec/components/mobile-stepper.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could mark it done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it's merged :)
src/MobileStepper/MobileStepper.js
Outdated
import { LinearProgress } from '../Progress'; | ||
|
||
export const styleSheet = createStyleSheet('MuiMobileStepper', theme => ({ | ||
mobileStepper: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather call it root
to follow the other components convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do - just an FYI tho, I was basing my work on the AppBar
component which uses appBar
not root
.
src/MobileStepper/MobileStepper.js
Outdated
left: 0, | ||
zIndex: theme.zIndex.mobileStepper, | ||
backgroundColor: theme.palette.background.paper, | ||
padding: '6px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following work just fine. Also, I'm wondering if we shouldn't use the standard 8 px spacing with theme.spacing.unit
.
padding: 6,
src/MobileStepper/MobileStepper.js
Outdated
dot: { | ||
backgroundColor: theme.palette.action.disabled, | ||
borderRadius: '50%', | ||
width: '10px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same we can use a number here.
src/MobileStepper/MobileStepper.js
Outdated
function MobileStepper(props) { | ||
const { | ||
activeStep, | ||
buttonClassName: buttonClassNameProp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we need that property as already accessible with classes.button
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same though for the other properties.
src/MobileStepper/MobileStepper.js
Outdated
return ( | ||
<Paper square elevation={0} className={className} {...other}> | ||
<Button className={buttonClassName} onClick={onBack} disabled={disableBack}> | ||
<KeyboardArrowLeft /> Back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about i118n? Maybe some label property?
src/MobileStepper/MobileStepper.js
Outdated
{Array.from(Array(steps)).map((_, step) => { | ||
const dotClassName = classNames( | ||
{ | ||
[classes.dot]: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's always true, you can pass is as an argument, that's simpler.
src/styles/zIndex.js
Outdated
@@ -12,4 +12,5 @@ export default { | |||
popover: 2100, | |||
snackbar: 2900, | |||
tooltip: 3000, | |||
mobileStepper: 1100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We sort theme by index value, not the right position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are referring to this conversation but this is not related - I've done this because I envisaged this being sticky & fixed to the bottom of the mobile device.
src/MobileStepper/MobileStepper.js
Outdated
position: 'fixed', | ||
bottom: 0, | ||
left: 0, | ||
zIndex: theme.zIndex.mobileStepper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, I would rather not have any positioning property in our low-level components. One might position his element using flexbox only and not fixed positioning. (that's what we do, that would conflict). Maybe we could add a fix position option? (Would also help with the demos!) I'm tempted to say that de default option should not be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had a bit of a think about this and I think perhaps by default I'll remove the fixed positioning, however I think a very common use case would be for it to be fixed either at the top or bottom so I'll add flags to trigger this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a prop position
in 65c70e3 which can be either bottom
or top
. By default MobileStepper
is now not fixed.
@oliviertassinari FYI I think I've addressed your concerns - I'll await your input when you're ready. |
d57fd2c
to
85150f1
Compare
@alexhayes Thanks! I took the liberty to make some changes. Let me know what you think. |
@oliviertassinari sorry yes I saw that but didn't have time to comment today before you merged. I'll comment now anyway and I'll create a separate PR if you think it's necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviertassinari let us know if you'd like me to submit any of these as a PR.
| dotClassName | string | | Specify an extra class to be put on each dot element | | ||
| dotsClassName | string | | Specify an extra class to be put the container that holds the dots | | ||
| progressClassname | string | | Specify an extra class to be put the container that holds the <LinearProgress /> component. | | ||
| activeStep | number | 0 | Set the active step (zero based index). This will enable `Step` control helpers. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the last sentence, This will enable
Step control helpers.
, makes much sense.
activeStep
doesn't enable something, it more sets something (in this case, the active property on a dot or the position on the progress component).
| disableBack | bool | false | Set to true to disable the back button. | | ||
| disableNext | bool | false | Set to true to disable the next button. | | ||
| nextButtonText | node | 'Next' | Set the text that appears for the next button. | | ||
| <span style="color: #31a148">onBack *</span> | function | | Passed into the onTouchTap prop of the Back button. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually passed into the onClick
of the button. I did this because I couldn't find any mention of onTouchTap
in either the docs or the Button
or BaseButton
components in the next
branch.
I think either the docs need to state onClick
or the code needs to be changed to use onTouchTap
if that is still the way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, we need to use onClick
.
| disableNext | bool | false | Set to true to disable the next button. | | ||
| nextButtonText | node | 'Next' | Set the text that appears for the next button. | | ||
| <span style="color: #31a148">onBack *</span> | function | | Passed into the onTouchTap prop of the Back button. | | ||
| <span style="color: #31a148">onNext *</span> | function | | Passed into the onTouchTap prop of the Next button. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
src/MobileStepper/MobileStepper.js
Outdated
@@ -17,22 +17,24 @@ export const styleSheet = createStyleSheet('MuiMobileStepper', theme => ({ | |||
flexDirection: 'row', | |||
justifyContent: 'space-between', | |||
alignItems: 'center', | |||
width: '100%', | |||
backgroundColor: theme.palette.background.paper, | |||
padding: theme.spacing.unit, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops.
| <span style="color: #31a148">onNext *</span> | function | | Passed into the onTouchTap prop of the Next button. | | ||
| position | enum: 'bottom'<br> 'top'<br> 'static'<br> | 'bottom' | Set the text that appears for the next button. | | ||
| <span style="color: #31a148">steps *</span> | number | | The total steps. | | ||
| type | enum: 'text'<br> 'dots'<br> 'progress'<br> | 'dots' | The type of mobile stepper to use. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure what is gained here by using the
apart from making it harder to read (when viewed raw).
I tried out a simple
mixed with the <br>
and it worked fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is automatically generated with yarn build:docs
.
|
||
const styleSheet = createStyleSheet('DotsMobileStepper', { | ||
root: { | ||
maxWidth: 400, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
}); | ||
}; | ||
|
||
render() { | ||
const classes = this.props.classes; | ||
return ( | ||
<div className={classes.root}> | ||
<Paper square elevation={0} className={classes.textualDescription}> | ||
Step {this.state.activeStep + 1} of 6 | ||
<Paper square elevation={0} className={classes.header}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer lines up with the < BACK
button.
While it's an issue with the docs and not an issue with the material-ui codebase I think it does look a little off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how it should line up.
|
||
## Mobile Stepper | ||
|
||
The [mobile steps](https://material.io/guidelines/components/steppers.html#steppers-types-of-steps) implements a compact stepper suitable for a mobile device. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this reads a little oddly. Perhaps;
This component implements a compact stepper suitable for a mobile device. See mobile steps for it's inspiration.
@alexhayes Thanks for the feedback. Would you mind submitting a PR to address those? 😄 . |
@oliviertassinari Yep I should have some more time this week to submit that. |
Awesome! |
@alexhayes Any luck? I will do it otherwise. |
Sorry, I've had a busy week and haven't had a chance yet. I should get some time mid this week. |
* [MobileStepper] Ensure correct spacing around buttons in MobileStepper. * [MobileStepper] Documentation changes as per discussion on #7043.
As discussed in issue #7033 this PR implements the three variations of mobile stepper outlined in the material guidelines.
Closes #7033.
Screenshots taken from the included docs;
Dots
Text
Progress