This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Merged
Conversation
a97dcc5 to
6b830ee
Compare
Collaborator
Changed dependencies are detected.Changed dependencies in
Generated by 🚫 dangerJS |
Codecov Report
@@ Coverage Diff @@
## master #1657 +/- ##
==========================================
- Coverage 70.03% 69.75% -0.29%
==========================================
Files 867 868 +1
Lines 7433 7483 +50
Branches 2164 2199 +35
==========================================
+ Hits 5206 5220 +14
- Misses 2219 2255 +36
Partials 8 8
Continue to review full report at Codecov.
|
miroslavstastny
commented
Jul 18, 2019
|
|
||
| const toolbarRadioGroupStyles: ComponentSlotStylesInput = { | ||
| root: (): ICSSInJSStyle => ({ | ||
| whiteSpace: 'nowrap', |
Member
Author
There was a problem hiding this comment.
without this items in radio group are wrapped if toolbar does not fit
Member
Dependency
|
Contributor
|
Detected by approved dependency check:
|
layershifter
approved these changes
Aug 7, 2019
Member
Author
|
Screener test is not working for overflow Toolbar, created a separate issue #1788. |
layershifter
pushed a commit
that referenced
this pull request
Aug 19, 2019
* wip * wip: add onReduceItems and required wrappers directly to Toolbar * fix build * add overflow menu to the example * - cancel animation frame cb on unmount * - prettified * Add react-resize-detector and its dependencies to approved dependencies * changelog (cherry picked from commit 25f8353)
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds possibility for a

Toolbarto move items which do not fit to an overflow menu:Based on requested use cases it is not enough to just remove items from end one by one and move them to the overflow menu. There is a requirement for the consumer to be able to specify custom "resize steps".
API
onReduceItems(renderedItems, measures): newItemsfunction has been added toToolbarProps. If this prop is specified,Toolbaris watching its size and if it does not fit, it calls this function so that the consumer can restructure the items.Basic idea
Technically this work is inspired by Office UI Fabric's ResizeGroup.
wrapperdiv.measurementdiv.measurementdiv, ahidden toolbaris renderedhidden toolbaris rendered, all its DOM children are measured and their rects are compared withwrapperrect to find out what overflows.onReduceItemscallback is called for the consumer to restructure the items, thehidden toolbaris re-rendered with the new items and the whole process repeatshidden toolbarfits thewrapper, current items are rendered tovisible toolbarandhidden toolbaris removedresize detectorinside thewrapperto detect width changes - if width changes,visible toolbaris not touched, but the whole process insidehidden toolbarstarts again with the initial (full) set of itemsPart of
ToolbarvsResponsiveToolbarvs universal wrapperThere are three options how to implement this:
👍user starts with
Toolbar, wants to just "enable responsiveness"👍implementation can be optimized for Toolbar
🛑complicates Toolbar implementation
🛑only for Toolbar
👍separation of concerns
👍implementation can be optimized for Toolbar
🛑user needs to replace components to enable responsiveness
🛑only for Toolbar
👍usable for any component
👍separation of concerns
🛑less intuitive for users
🛑cannot be optimized for Toolbar
After offline discussion with @levithomason we agreed to start with option 1.
Known issues, todos
onReduceItemsimplementation is in hands of a consumer and is not a straightforward/simple thingToolbarMenucan contain only items and divider, there is no way how to move radiogroup and custom items to the overflow menurequestAnimationFrameregistrations must be canceled on unmount