Skip to content
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

feat(top-app-bar): Add prominent style #2349

Merged
merged 11 commits into from
Mar 12, 2018

Conversation

williamernest
Copy link
Contributor

@williamernest williamernest commented Mar 6, 2018

fixes #2378
Adds prominent style.

@codecov-io
Copy link

codecov-io commented Mar 6, 2018

Codecov Report

Merging #2349 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2349   +/-   ##
=======================================
  Coverage   98.85%   98.85%           
=======================================
  Files         100      100           
  Lines        4118     4118           
  Branches      527      527           
=======================================
  Hits         4071     4071           
  Misses         47       47

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e648123...1a5e697. Read the comment docs.

@@ -227,9 +243,13 @@ <h3>Demo Controls</h3>
appBarEl.classList.remove('mdc-top-app-bar--short-collapsed');
appBarEl.classList.remove('mdc-top-app-bar--short-has-action-item');
alwaysCollapsedCheckbox.checked = false;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: reverse the if/else so the if is the positive condition

@@ -238,6 +258,10 @@ <h3>Demo Controls</h3>
appBar.destroy();
appBar = mdc.topAppBar.MDCTopAppBar.attachTo(appBarEl);
});

prominentCheckbox.addEventListener('change', function() {
appBarEl.classList[this.checked ? 'add' : 'remove']('mdc-top-app-bar--prominent');
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd point out that we're disabling the prominent checkbox when short is checked, but not vice versa... do we want these to consistently either toggle each other or disable each other? (If we make it so that prominent disables short, we shouldn't need to uncheck prominent in the short checkbox handler since it would need to be unchecked manually first)

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. I changed it so the prominent disabled the short checkbox and vice versa.

flex-direction: column;
margin: 0 20px 20px 20px;

& > span {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should really avoid element selectors... Could we use something like <h4 class="mdc-typography--subheading2 mdc-typography--adjust-margin for these elements instead? (And maybe use mdc-typography--title on the Demo Controls heading?)

@@ -2,6 +2,16 @@
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"JSONStream": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think package-lock needs to be in this PR...

@@ -130,5 +130,24 @@
}
}

.mdc-top-app-bar--prominent {
.mdc-top-app-bar__row {
min-height: $mdc-top-app-bar-prominent-row-height;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this using min-height rather than height? Would something cause this to be even taller? And would we not be eventually interested in this collapsing to one line's height on scroll?

padding-bottom: $mdc-top-app-bar-prominent-title-bottom-padding;
}

.mdc-top-app-bar__action-item {
Copy link
Contributor

Choose a reason for hiding this comment

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

Combine this and the next selector into one block?

Copy link
Contributor

@bonniezhou bonniezhou left a comment

Choose a reason for hiding this comment

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

One tiny nit, otherwise LGTM!

@@ -55,3 +55,21 @@
input[type="checkbox"]:disabled + label {
opacity: .4;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove extra line

display: flex;
flex: 1 1 auto;
flex-direction: column;
margin: 0 20px 20px 20px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: last 20px can be omitted


.mdc-top-app-bar--prominent {
.mdc-top-app-bar__row {
height: $mdc-top-app-bar-prominent-row-height;
Copy link
Contributor

Choose a reason for hiding this comment

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

So, RE my earlier comment RE min-height, I just realized that you're using min-height everywhere that you're setting height for __row, so I guess my question applies to all of them. I imagine in these cases you're intentionally overriding those, so it makes sense for them to match, I'm just not sure offhand why they use min-height.


.mdc-top-app-bar--prominent {
.mdc-top-app-bar__row {
height: $mdc-top-app-bar-prominent-row-height;
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, shouldn't this line not even be necessary if you decrease the specificity of .mdc-top-app-bar .mdc-top-app-bar__row to just the latter class, further above in this mixin? I don't think those first 3 selectors should need 2 classes each, since they don't have 2 classes each in the default styles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first three selectors do have 2 classes each in the default styles.

}

.mdc-top-app-bar--short {
transition: width 200ms $mdc-animation-standard-curve-timing-function;

.mdc-top-app-bar__row {
min-height: $mdc-top-app-bar-mobile-row-height;
height: $mdc-top-app-bar-mobile-row-height;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect this rule is also not needed? Both the non-mobile short row rule and the default mobile breakpoint rule already use this value for height.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add href attribute for A element in top-app-bar demo
4 participants