Skip to content

Stepper alternative label - #12674

Merged
mmalerba merged 2 commits into
angular:masterfrom
IlCallo:stepper-alternative-label
Sep 21, 2018
Merged

Stepper alternative label#12674
mmalerba merged 2 commits into
angular:masterfrom
IlCallo:stepper-alternative-label

Conversation

@IlCallo

Copy link
Copy Markdown
Contributor

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

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

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

IlCallo commented Aug 14, 2018

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@googlebotgooglebot 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
Copy Markdown

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.

@googlebotgooglebot 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
Copy Markdown
ContributorAuthor

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

ngbotBot commented Aug 23, 2018

Copy link
Copy Markdown

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

CLAs look good, thanks!

@googlebotgooglebot 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
Copy Markdown
ContributorAuthor

Everything should be fine now

Comment threadsrc/lib/stepper/stepper.ts Outdated
inputs: ['selectedIndex'],
host: {
'class': 'mat-stepper-horizontal',
'[class.mat-stepper--alternative-label]': 'alternativeLabel',

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

Comment threadsrc/lib/stepper/stepper.scss Outdated
margin: 0;
min-width: 0;
position: relative;
top: $mat-stepper-side-gap + $mat-stepper-label-header-height/2;

Copy link
Copy Markdown
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 '/'

Comment threadsrc/lib/stepper/stepper.scss Outdated
display: inline-block;
height: 0;
position: absolute;
top: $mat-stepper-side-gap + $mat-stepper-label-header-height/2;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: space around '/'

Comment threadsrc/lib/stepper/stepper.scss Outdated
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
Copy Markdown
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});

Comment threadsrc/lib/stepper/stepper.scss Outdated
margin-left: $mat-stepper-line-gap;
}
}
.mat-stepper-alternative-label & {

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

Choose a reason for hiding this comment

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

nit: \n

Comment threadsrc/lib/stepper/stepper.ts Outdated
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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> No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: \n

@mmalerbammalerba left a comment

Copy link
Copy Markdown
Contributor

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

Comment threadsrc/lib/stepper/stepper.scss Outdated
// 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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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

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

@IlCallo

Copy link
Copy Markdown
ContributorAuthor

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

@mmalerba

Copy link
Copy Markdown
Contributor

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.

@mmalerbammalerba 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

ngbotBot commented Sep 18, 2018

Copy link
Copy Markdown

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

ngbotBot commented Sep 18, 2018

Copy link
Copy Markdown

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

@ngbot

ngbotBot commented Sep 18, 2018

Copy link
Copy Markdown

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

@ngbot

ngbotBot commented Sep 18, 2018

Copy link
Copy Markdown

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:masterSep 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
Copy Markdown

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-botangular-automatic-lock-botBot locked and limited conversation to collaborators Sep 9, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: mergeThe PR is ready for merge by the caretakercla: yesPR author has agreed to Google's Contributor License Agreementtarget: minorThis PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@IlCallo@googlebot@mmalerba