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 --fixed variant to top app bar #2474

Merged
merged 6 commits into from
Apr 5, 2018

Conversation

williamernest
Copy link
Contributor

Fixes: #2425

@codecov-io
Copy link

codecov-io commented Mar 27, 2018

Codecov Report

Merging #2474 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2474      +/-   ##
==========================================
+ Coverage   98.67%   98.71%   +0.03%     
==========================================
  Files         102      103       +1     
  Lines        4090     4111      +21     
  Branches      512      516       +4     
==========================================
+ Hits         4036     4058      +22     
+ Misses         54       53       -1
Impacted Files Coverage Δ
packages/mdc-top-app-bar/constants.js 100% <ø> (ø) ⬆️
packages/mdc-top-app-bar/fixed/foundation.js 100% <100%> (ø)
packages/mdc-top-app-bar/index.js 100% <100%> (+2.63%) ⬆️

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 797c7e6...68e400c. Read the comment docs.

@@ -26,6 +26,8 @@ const strings = {

/** @enum {string} */
const cssClasses = {
FIXED_CLASS: 'mdc-top-app-bar--fixed',
FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed__scrolled',
Copy link
Contributor

Choose a reason for hiding this comment

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

In BEM, __ indicates a sub-element, but this appears to be a modifier class (for a modifier class - yo dawg).

We normally handle that by using a single - instead of __.

E.g.: mdc-top-app-bar--fixed-scrolled

*/
constructor(adapter) {
super(adapter);
// State variable for the previous top app bar state
Copy link
Contributor

@acdvorak acdvorak Mar 28, 2018

Choose a reason for hiding this comment

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

Pro ~~~tip~~~ nit: Always use /** comments to document fields and methods.

Editors like IntelliJ will parse the JSDoc /** comments and display them inline when you hit Ctrl+Q.

@@ -145,5 +145,13 @@
}
}

.mdc-top-app-bar--fixed {
position: fixed;
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want some kind of transition for box-shadow to make the transition between --fixed and --fixed-scrolled a little smoother.

Copy link
Contributor

@acdvorak acdvorak left a comment

Choose a reason for hiding this comment

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

Just a question about transition for elevation and a few nits. Otherwise LGTM!

});

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

Choose a reason for hiding this comment

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

Nit: You might also want to toggle/remove mdc-top-app-bar--fixed-scrolled here, if it's not too hard to do.

Copy link
Contributor

@acdvorak acdvorak left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

3 participants