Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

feat(top-app-bar): Switch to use variant specific foundations #2412

Merged
merged 3 commits into from
Mar 16, 2018

Conversation

williamernest
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Mar 15, 2018

Codecov Report

Merging #2412 into master will decrease coverage by 0.02%.
The diff coverage is 97.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2412      +/-   ##
==========================================
- Coverage   98.89%   98.86%   -0.03%     
==========================================
  Files         100      101       +1     
  Lines        4145     4151       +6     
  Branches      531      531              
==========================================
+ Hits         4099     4104       +5     
- Misses         46       47       +1
Impacted Files Coverage Δ
packages/mdc-top-app-bar/foundation.js 100% <ø> (ø) ⬆️
packages/mdc-top-app-bar/short/foundation.js 100% <100%> (ø)
packages/mdc-top-app-bar/index.js 97.36% <95%> (-2.64%) ⬇️

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 2dfaec6...8ae5312. Read the comment docs.

);

let foundation;
if (this.root_.classList.contains(cssClasses.SHORT_CLASS)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you run this by Lynn? Given our desire to avoid putting business logic on the component level, this seems to go against that, but I suppose having different components for each type would be overkill...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We talked a bit about it over the past couple days. She asked me to create this PR so she could go over how I broke it up and start the discussion. I'm not sure where this block of code would really belong we don't want it in the Component.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think this might be exactly the kind of logic we want to change per web platform

  • Vanilla JavaScript: Read the DOM to decide which type of foundation to use
  • React: Read a React prop to decide which type of foundation to use
  • Internal Google JavaScript: Read some internal property available at initiate-time

);

let foundation;
if (this.root_.classList.contains(cssClasses.SHORT_CLASS)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think this might be exactly the kind of logic we want to change per web platform

  • Vanilla JavaScript: Read the DOM to decide which type of foundation to use
  • React: Read a React prop to decide which type of foundation to use
  • Internal Google JavaScript: Read some internal property available at initiate-time

}

init() {
const isAlwaysCollapsed = this.adapter_.hasClass(cssClasses.SHORT_COLLAPSED_CLASS);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could call super.initi() and then not have to register the scroll handler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This scroll handler is specific to this variant (short). The base foundation has the navigation icon click handler logic, since that will apply to all variants.

}

destroy() {
this.adapter_.deregisterScrollHandler(this.scrollHandler_);
Copy link
Contributor

Choose a reason for hiding this comment

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

super.destroy();

Copy link
Contributor

@lynnmercier lynnmercier 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants