Skip to content

Minimize layer panel height + fixes for expanding/collapsing#704

Merged
wassgha merged 7 commits intomasterfrom
layer-panel
Mar 27, 2020
Merged

Minimize layer panel height + fixes for expanding/collapsing#704
wassgha merged 7 commits intomasterfrom
layer-panel

Conversation

@wassgha
Copy link
Copy Markdown
Contributor

@wassgha wassgha commented Mar 22, 2020

Following a discussion with @samitron7 the layer panel should occupy as little space as possible.

Changes

  • Use layers count to calculate the initial layer panel height (depending on the current page)
  • Fix an issue where expanding a collapsed panel would leave it at the collapsed state
  • Ensure that if a manual height change is issued, the re-expanding of the panel uses the manually issued height

Before:

After:

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 22, 2020

Size Change: +296 B (0%)

Total Size: 499 kB

Filename Size Change
assets/js/edit-story.js 429 kB +296 B (0%)
ℹ️ View Unchanged
Filename Size Change
assets/css/edit-story.css 3.01 kB 0 B
assets/css/stories-dashboard.css 206 B 0 B
assets/js/stories-dashboard.js 66.4 kB 0 B

compressed-size-action

@swissspidy swissspidy added the Type: Enhancement New feature or improvement of an existing feature label Mar 23, 2020
Copy link
Copy Markdown
Collaborator

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

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

Works well!

One thought:

Does it make sense to support cancelling the manually set height again somehow? I was thinking that a double click on the drag handle could set setManuallyChanged(false) again.

Thoughts?

@swissspidy
Copy link
Copy Markdown
Collaborator

Created #717 for my double click suggestion.

@pbakaus
Copy link
Copy Markdown
Contributor

pbakaus commented Mar 24, 2020

this is cool!

@wassgha wassgha requested a review from dvoytenko March 24, 2020 01:17
Copy link
Copy Markdown
Contributor

@barklund barklund left a comment

Choose a reason for hiding this comment

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

Looks good, just a minor concern.

Comment on lines +46 to +50
useEffect(() => {
if (height === 0 && isCollapsed === false) {
collapse();
}
}, [collapse, height, isCollapsed]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems a bit disruptive. When you drag it too low, you can't drag it back up again, as the drag handle is now completely missing. Could we maybe only do this on release in the drag handler?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rethought the entire interaction, please see last commit

@wassgha
Copy link
Copy Markdown
Contributor Author

wassgha commented Mar 26, 2020

@dvoytenko @barklund I've re-thought the collapse/expand interaction and introduced a new state that preserves the height before collapsing, which should make the experience better for both tapping the collapse button or manually collapsing by dragging.

@miina
Copy link
Copy Markdown
Contributor

miina commented Mar 26, 2020

Tests failing due to:
panels

@wassgha
Copy link
Copy Markdown
Contributor Author

wassgha commented Mar 26, 2020

Tests failing due to:
panels

Awesome that the test caught that! Fixed :))

Copy link
Copy Markdown
Contributor

@barklund barklund left a comment

Choose a reason for hiding this comment

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

One minor comment and needs testing. Otherwise looks and feels good.

`;

function Panel({ initialHeight, name, children }) {
function Panel({ resizeable, initialHeight, name, children }) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd really like to see all this new functionality integration tested in a functioning panel with clicks, drags, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Filed #840 for this since it might take some time and this PR is blocking two others

@wassgha wassgha merged commit b1edefd into master Mar 27, 2020
@wassgha wassgha deleted the layer-panel branch March 27, 2020 18:02
obetomuniz added a commit that referenced this pull request Mar 30, 2020
* master:
  Update list of Google Fonts
  Bump babel-jest from 25.2.3 to 25.2.4 (#851)
  Resize video while resizing (#804)
  Bump @wordpress/components from 9.2.5 to 9.2.6 (#839)
  Bump eslint-plugin-testing-library from 2.2.3 to 3.0.0 (#849)
  Bump react-moveable from 0.18.1 to 0.19.0 (#850)
  Bump lint-staged from 10.0.9 to 10.0.10
  Bump eslint-plugin-import from 2.20.1 to 2.20.2 (#846)
  Auto-select entire input field on focus (#811)
  Disallow masking for background. (#827)
  Reduce timing difference for entering edit mode. (#829)
  Clicking on media in the gallery should never insert as background (#841)
  Bump @testing-library/dom from 7.1.2 to 7.1.3 (#843)
  Reorderable drag and drop component (#709)
  Minimize layer panel height + fixes for expanding/collapsing (#704)
  remove lingering extra styled component import comment
  adding tests for which icon is present on chip bookmark
  some clean up
  bookmark chip ui component. 2 sizes controlled by constants.js. Storybook + a very basic test
  Template Animations: Added float-on animation (#618)
@swissspidy
Copy link
Copy Markdown
Collaborator

Added to alpha branch

swissspidy added a commit that referenced this pull request Mar 30, 2020
* Adapt initial layer panel height to layer numbers

* Support double click on layer panel drag handle to reset height (#717)

* Added maximum initial layer number to show

* Rethink collapse/expand logic

* Fixed issue that broke tests

* Double click expands the panel

Co-authored-by: Pascal Birchler <pascalb@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement New feature or improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants