Uh oh!
There was an error while loading. Please reload this page.
Stepper alternative label - #12674
Conversation
googlebot
commented
Aug 14, 2018
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I already signed the CLA earlier today as a Corporate (Dreamonkey S.r.l.) of which I'm the Point of Contact. I'm not even sure about how to fix the |
IlCallo
commented
Aug 21, 2018
I can confirm that the Corporate CLA has been accepted for my company |
googlebot
commented
Aug 21, 2018
CLAs look good, thanks! |
googlebot
commented
Aug 23, 2018
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
IlCallo
commented
Aug 23, 2018
I squashed all commits in a single one and removed the import which gave problems, but it seems that now CLA is complaining. |
Hi @IlCallo! This PR has merge conflicts due to recent upstream merges. |
mmalerba
commented
Aug 23, 2018
It looks like you somehow wound up including a bunch of other commits from other authors, if it's too difficult to fix you can just move the changes to a new PR |
googlebot
commented
Aug 24, 2018
CLAs look good, thanks! |
IlCallo
commented
Aug 24, 2018
Everything should be fine now |
| inputs: ['selectedIndex'], | ||
| host: { | ||
| 'class': 'mat-stepper-horizontal', | ||
| '[class.mat-stepper--alternative-label]': 'alternativeLabel', |
There was a problem hiding this comment.
nit: I don't think we use the -- style anywhere else in our code, use - for consistency
| margin: 0; | ||
| min-width: 0; | ||
| position: relative; | ||
| top: $mat-stepper-side-gap + $mat-stepper-label-header-height/2; |
| display: inline-block; | ||
| height: 0; | ||
| position: absolute; | ||
| top: $mat-stepper-side-gap + $mat-stepper-label-header-height/2; |
| height: 0; | ||
| position: absolute; | ||
| top: $mat-stepper-side-gap + $mat-stepper-label-header-height/2; | ||
| width: calc(50% - #{$mat-stepper-label-header-height/2} - #{$mat-stepper-line-gap}); |
There was a problem hiding this comment.
you can combine the second and third terms in SASS:
calc(50% - #{$mat-stepper-label-header-height/2-$mat-stepper-line-gap});| margin-left: $mat-stepper-line-gap; | ||
| } | ||
| } | ||
| .mat-stepper-alternative-label & { |
| &:not(:last-child)::after { | ||
| @extend %mat-header-horizontal-line-alternative-label; | ||
| right: 0; | ||
| } |
| &:not(:first-child)::before { | ||
| @extend %mat-header-horizontal-line-alternative-label; | ||
| left: 0; | ||
| } |
| & .mat-step-icon, | ||
| & .mat-step-icon-not-touched { | ||
| margin-right: 0; | ||
| } |
| export class MatHorizontalStepper extends MatStepper { | ||
| /** Whether the label should display in the alternative or normal mode. */ | ||
| @Input() | ||
| get alternativeLabel(): boolean { return this._alternativeLabel; } |
There was a problem hiding this comment.
Although the spec calls it an "alternative label", I don't think it's an intuitive name to give it in the API. How about labelPosition which can have the following values: bottom - below the icon, end - after the icon (to the right in LTR / to the left in RTL). This would also leave open the possibility of future values like top and start
There was a problem hiding this comment.
How should I change CSS classes name with the API you proposed?
label-bottom and label-end don't really seem good names...
I agree with you that alternativeLabel may not be the perfect name, but I'd prefer leaving it as an on/off property until someone actually needs to put it in top or start position...
(Sorry for delay, I was in vacation)
There was a problem hiding this comment.
I'm not saying we should add support for start and top right now. I'm just saying that its more clear what the API does if we call it labelPosition and it leaves us open to adding new values in the future. I think class names like .mat-step-label-position-end would be good
There was a problem hiding this comment.
I should have addressed all of yor concerns.
I did not changed previous code (I did not created a .mat-step-label-position-end SCSS class) to avoid breaking things (even if that class is actually added to the element for consistency).
Now the alternative label is applied when labelPosition is set to bottom
| <button mat-button (click)="stepper.reset()">Reset</button> | ||
| </div> | ||
| </mat-step> | ||
| </mat-horizontal-stepper> No newline at end of file |
| // We use auto instead of fixed 104px (by spec) because when there is an optional step | ||
| // the height is greater than that | ||
| height: auto; | ||
| min-width: 100px; |
There was a problem hiding this comment.
where does this 100px come from?
There was a problem hiding this comment.
Nowhere currently, the spec doesn't specify a minimum width (or I didn't find it) so I chose one.
Do you have any suggestions about?
There was a problem hiding this comment.
Is having a min-width important to get it to lay out right? if not I would just leave it off and people can specify their own if they want. If we do need one just put it in an SCSS variable
There was a problem hiding this comment.
It just shrinks until only the step icon is still visible, making the label useless.
Shall I remove it?
There was a problem hiding this comment.
Yeah I think its best to just remove it and let people decide their own min
There was a problem hiding this comment.
Fixed RTL and removed min-width
mmalerba
commented
Sep 6, 2018
IlCallo
commented
Sep 7, 2018
No problem, thank you for pointing it out, I didn't even see that :) |
mmalerba
commented
Sep 7, 2018
Awesome, looks good aside from this lint error: |
Hi @IlCallo! This PR has merge conflicts due to recent upstream merges. |
3 similar comments
Hi @IlCallo! This PR has merge conflicts due to recent upstream merges. |
Hi @IlCallo! This PR has merge conflicts due to recent upstream merges. |
Hi @IlCallo! This PR has merge conflicts due to recent upstream merges. |
Added the "alternative label" version, as by [(old) spec](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steppers). Tryed on Chrome, Firefox, Edge and IE11 and everything seems fine. Added a paragraph in the stepper documentation and an example. I'm not sure the code style is ok so if you have suggestions I'll be happy to clean it up a bit, just tell me how :)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |



Added the "alternative label" version, as by (old) spec.
Tryed on Chrome, Firefox, Edge and IE11 and everything seems fine.
Added a paragraph in the stepper documentation and an example.
I'm not sure the code style is ok so if you have suggestions I'll be happy to clean it up a bit, just tell me how :)