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(tab-scroller): Add scroll content width method for use in tab bar #3222

Merged
merged 6 commits into from
Jul 26, 2018

Conversation

patrickrodee
Copy link
Contributor

Expose method on foundation and component to get the width of the scroll content element. Add tests for newly exposed scroll content width methods. Add classes for adjusting layout of scroll content child elements. Update test coverage.

@mdc-web-bot
Copy link
Collaborator

All 128 screenshot tests passed for commit 9cbad57 vs. feat/tabs/tabs! 💯🎉

@codecov-io
Copy link

codecov-io commented Jul 26, 2018

Codecov Report

Merging #3222 into feat/tabs/tabs will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           feat/tabs/tabs    #3222      +/-   ##
==================================================
+ Coverage           98.28%   98.28%   +<.01%     
==================================================
  Files                 114      114              
  Lines                4831     4835       +4     
  Branches              603      604       +1     
==================================================
+ Hits                 4748     4752       +4     
  Misses                 83       83
Impacted Files Coverage Δ
packages/mdc-tab-scroller/foundation.js 100% <100%> (ø) ⬆️
packages/mdc-tab-scroller/index.js 100% <100%> (ø) ⬆️

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 c5caeba...dda2915. Read the comment docs.

@mdc-web-bot
Copy link
Collaborator

All 128 screenshot tests passed for commit 5205f66 vs. feat/tabs/tabs! 💯🎉

@@ -111,3 +115,4 @@ Method Signature | Description
`scrollTo(scrollX: number) => void` | Scrolls to the `scrollX` value.
`incrementScroll(scrollX: number) => void` | Increments the current scroll value by the `scrollX` value.
`getScrollPosition() => number` | Returns the current visual scroll position.
`getScrollContentWidth() => number` | Returns the width of the scroll content element.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually needed on the foundation, or could we simply write a one-liner referencing the correct node in the component?

@patrickrodee
Copy link
Contributor Author

patrickrodee commented Jul 26, 2018 via email

@@ -65,6 +65,9 @@ CSS Class | Description
`mdc-tab-scroller` | Mandatory. Contains the tab scroller content.
`mdc-tab-scroller__scroll-area` | Mandatory. Denotes the scrolling area.
`mdc-tab-scroller__scroll-content` | Mandatory. Denotes the scrolling content.
`mdc-tab-scroller--start-aligned` | Optional. Sets the elements inside the scroll content element to be aligned to the start of the scroll content element.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: --align-start, --align-end, and --align-center would...align...with modifier classes we have on a few other components

* Returns the width of the scroll content
* @return {number}
*/
getScrollContentWidth() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Ken on this one. I don't think this method is needed, and can just be a one liner in the component.

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 don't disagree. Since this is a subcomponent that's required inside of another, we have yet to figure out a pattern for accessing the child elements of a subcomponent.

@@ -59,6 +59,18 @@
will-change: transform;
}

.mdc-tab-scroller--start-aligned .mdc-tab-scroller__scroll-content {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having all three (start, end, center), could you just have 2 where 1 is the default?

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 default is that they fill the horizontal space completely with no specific alignment. These three options are all optional.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah gotcha :)

@mdc-web-bot
Copy link
Collaborator

All 128 screenshot tests passed for commit 7f2a698 vs. feat/tabs/tabs! 💯🎉

@@ -59,6 +59,18 @@
will-change: transform;
}

.mdc-tab-scroller--start-aligned .mdc-tab-scroller__scroll-content {
Copy link
Contributor

Choose a reason for hiding this comment

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

The docs were updated but these classes were not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lololol i'm a fool 😮

@mdc-web-bot
Copy link
Collaborator

All 128 screenshot tests passed for commit f3c0c55 vs. feat/tabs/tabs! 💯🎉

@mdc-web-bot
Copy link
Collaborator

All 128 screenshot tests passed for commit dda2915 vs. feat/tabs/tabs! 💯🎉

@patrickrodee patrickrodee merged commit 052bc9e into feat/tabs/tabs Jul 26, 2018
kfranqueiro pushed a commit that referenced this pull request Jul 27, 2018
WIP fixed bg coloring of icons

fix(tab-indicator): Use absolute positioning (#2547)

WIP start of tab scroller

WIP fixed transition duration

WIP progress on scroller

WIP added demos back

chore(tabs): Removed tab scroller

feat(tabs): Add tab indicator inside tab (#2565)

feat(tab-scroller): Add tab scroller (#2577)

Merge master into feat/tabs/tabs (#3096)

feat(tab): Update tab color and typography (#3108)

docs(tabs): Update metadata and synopses (#3117)

feat(tab): Add MDCTabDimensions computation (#3122)

feat(tab): Emit selection and activation events (#3139)

docs(tabs): Update new READMEs to match standard (#3142)

feat(tab): Give focus to tab when activated (#3164)

feat(tab): Add mixin for parent positioning; Use mixin in tab scroller (#3179)

fix(tabs): Suppress area occupied by scrollbar on platforms that show it (#3149)

fix(tab): Remove extraneous padding from the stacked text label in LTR (#3193)

feat(tabs): Add missing docs and create helper util API (#3194)

Merge master into feat/tabs/tabs (#3227)

feat(tab): Update layout; Add fixed-width mixin; Add min-width class (#3220)

fix(tab-scroller): Fix incorrect animation stopping scroll value in RTL (#3237)

feat(tab-scroller): Add scroll content width method for use in tab bar (#3222)

feat(tab): Remove activation event emitting (#3242)

feat(tab-bar): Add tab bar (#3229)
@kfranqueiro kfranqueiro deleted the feat/tabs/tab-scroller-updates branch August 1, 2018 16:18
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.

5 participants