Skip to content

Stepper alternative label #12674

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

Merged
merged 2 commits into from
Sep 21, 2018
Merged

Stepper alternative label #12674

merged 2 commits into from
Sep 21, 2018

Conversation

IlCallo
Copy link
Contributor

@IlCallo IlCallo commented Aug 14, 2018

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 :)

@googlebot
Copy link

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. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@googlebot googlebot added the cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla label Aug 14, 2018
@IlCallo
Copy link
Contributor Author

IlCallo commented Aug 14, 2018

I already signed the CLA earlier today as a Corporate (Dreamonkey S.r.l.) of which I'm the Point of Contact.
I see that I've committed using the wrong email tho, but I'm not sure about how I can resolve the issue given the fact that I already created the PR.

I'm not even sure about how to fix the Can't find stylesheet to import @import './step-header'; error, the file is there and I succesfully built it locally.

@IlCallo
Copy link
Contributor Author

IlCallo commented Aug 21, 2018

I can confirm that the Corporate CLA has been accepted for my company

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Aug 21, 2018
@googlebot
Copy link

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 cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot googlebot added cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Aug 23, 2018
@IlCallo
Copy link
Contributor Author

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.
I'm not really sure about which email I shall use for commits at this point: the one in the google group for the CLA is the same used for the squashed commit and it's my main email on Github, still the bot is complaining...

@ngbot
Copy link

ngbot bot commented Aug 23, 2018

Hi @IlCallo! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@mmalerba
Copy link
Contributor

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
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Aug 24, 2018
@IlCallo
Copy link
Contributor Author

IlCallo commented Aug 24, 2018

Everything should be fine now

@@ -123,6 +126,7 @@ export class MatStepper extends _CdkStepper implements AfterContentInit {
inputs: ['selectedIndex'],
host: {
'class': 'mat-stepper-horizontal',
'[class.mat-stepper--alternative-label]': 'alternativeLabel',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: put space around '/'

display: inline-block;
height: 0;
position: absolute;
top: $mat-stepper-side-gap + $mat-stepper-label-header-height/2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space around '/'

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});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can combine the second and third terms in SASS:

calc(50% - #{$mat-stepper-label-header-height / 2 - $mat-stepper-line-gap});

@@ -44,6 +68,33 @@ $mat-stepper-line-gap: 8px !default;
margin-left: $mat-stepper-line-gap;
}
}
.mat-stepper-alternative-label & {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: \n

&:not(:last-child)::after {
@extend %mat-header-horizontal-line-alternative-label;
right: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: \n

&:not(:first-child)::before {
@extend %mat-header-horizontal-line-alternative-label;
left: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: \n

& .mat-step-icon,
& .mat-step-icon-not-touched {
margin-right: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: \n

export class MatHorizontalStepper extends MatStepper {
/** Whether the label should display in the alternative or normal mode. */
@Input()
get alternativeLabel(): boolean { return this._alternativeLabel; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: \n

Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you might need to add a few additional styles for RTL languages:
stepper-rtl

// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does this 100px come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just shrinks until only the step icon is still visible, making the label useless.
Shall I remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think its best to just remove it and let people decide their own min

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed RTL and removed min-width

@mmalerba
Copy link
Contributor

mmalerba commented Sep 6, 2018

Sorry to be nit-picky, but it still looks slightly off in RTL:
stepper-rtl
vs LTR:
stepper-ltr

@IlCallo
Copy link
Contributor Author

IlCallo commented Sep 7, 2018

No problem, thank you for pointing it out, I didn't even see that :)
Should be fine now

@mmalerba
Copy link
Contributor

mmalerba commented Sep 7, 2018

Awesome, looks good aside from this lint error:

ERROR: /home/travis/build/angular/material2/src/lib/stepper/stepper.ts[11, 1]: All imports on this line are unused.

@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Sep 10, 2018
@ngbot
Copy link

ngbot bot commented Sep 18, 2018

Hi @IlCallo! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

3 similar comments
@ngbot
Copy link

ngbot bot commented Sep 18, 2018

Hi @IlCallo! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@ngbot
Copy link

ngbot bot commented Sep 18, 2018

Hi @IlCallo! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@ngbot
Copy link

ngbot bot commented Sep 18, 2018

Hi @IlCallo! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@mmalerba mmalerba merged commit e4c6cc9 into angular:master Sep 21, 2018
@IlCallo IlCallo deleted the stepper-alternative-label branch October 15, 2018 14:54
roboshoes pushed a commit to roboshoes/material2 that referenced this pull request Oct 23, 2018
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 :)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants