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

Use Card instead of Panel for the block editor #22827

Merged
merged 6 commits into from
Jun 4, 2020

Conversation

adamziel
Copy link
Contributor

@adamziel adamziel commented Jun 2, 2020

Description

There is no reason to make the BlockEditorPanel collapsible, so let's use Card instead of Panel there. A follow-up PR will make the other panel only collapsible on mobile devices.

Before:
Zrzut ekranu 2020-06-2 o 14 59 09

After:
Zrzut ekranu 2020-06-2 o 14 58 56

Types of changes

Non-breaking changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@github-actions
Copy link

github-actions bot commented Jun 2, 2020

Size Change: +84 B (0%)

Total Size: 1.12 MB

Filename Size Change
build/edit-navigation/index.js 8.24 kB +1 B
build/edit-navigation/style-rtl.css 918 B +40 B (4%)
build/edit-navigation/style.css 919 B +43 B (4%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.62 kB 0 B
build/api-fetch/index.js 3.4 kB 0 B
build/autop/index.js 2.83 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 6.48 kB 0 B
build/block-directory/style-rtl.css 787 B 0 B
build/block-directory/style.css 787 B 0 B
build/block-editor/index.js 106 kB 0 B
build/block-editor/style-rtl.css 11.4 kB 0 B
build/block-editor/style.css 11.4 kB 0 B
build/block-library/editor-rtl.css 7.87 kB 0 B
build/block-library/editor.css 7.88 kB 0 B
build/block-library/index.js 126 kB 0 B
build/block-library/style-rtl.css 7.69 kB 0 B
build/block-library/style.css 7.68 kB 0 B
build/block-library/theme-rtl.css 684 B 0 B
build/block-library/theme.css 686 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 48.2 kB 0 B
build/components/index.js 190 kB 0 B
build/components/style-rtl.css 19.5 kB 0 B
build/components/style.css 19.5 kB 0 B
build/compose/index.js 9.32 kB 0 B
build/core-data/index.js 11.4 kB 0 B
build/data-controls/index.js 1.29 kB 0 B
build/data/index.js 8.43 kB 0 B
build/date/index.js 5.47 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 3.11 kB 0 B
build/edit-post/index.js 302 kB 0 B
build/edit-post/style-rtl.css 5.43 kB 0 B
build/edit-post/style.css 5.43 kB 0 B
build/edit-site/index.js 14.1 kB 0 B
build/edit-site/style-rtl.css 2.96 kB 0 B
build/edit-site/style.css 2.96 kB 0 B
build/edit-widgets/index.js 8.81 kB 0 B
build/edit-widgets/style-rtl.css 2.4 kB 0 B
build/edit-widgets/style.css 2.4 kB 0 B
build/editor/editor-styles-rtl.css 425 B 0 B
build/editor/editor-styles.css 428 B 0 B
build/editor/index.js 44.6 kB 0 B
build/editor/style-rtl.css 4.26 kB 0 B
build/editor/style.css 4.27 kB 0 B
build/element/index.js 4.64 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.71 kB 0 B
build/format-library/style-rtl.css 502 B 0 B
build/format-library/style.css 502 B 0 B
build/hooks/index.js 2.13 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 3.56 kB 0 B
build/is-shallow-equal/index.js 711 B 0 B
build/keyboard-shortcuts/index.js 2.51 kB 0 B
build/keycodes/index.js 1.94 kB 0 B
build/list-reusable-blocks/index.js 3.13 kB 0 B
build/list-reusable-blocks/style-rtl.css 226 B 0 B
build/list-reusable-blocks/style.css 226 B 0 B
build/media-utils/index.js 5.29 kB 0 B
build/notices/index.js 1.79 kB 0 B
build/nux/index.js 3.4 kB 0 B
build/nux/style-rtl.css 616 B 0 B
build/nux/style.css 613 B 0 B
build/plugins/index.js 2.56 kB 0 B
build/primitives/index.js 1.5 kB 0 B
build/priority-queue/index.js 789 B 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/rich-text/index.js 14.8 kB 0 B
build/server-side-render/index.js 2.68 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.28 kB 0 B
build/url/index.js 4.02 kB 0 B
build/viewport/index.js 1.84 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

@adamziel adamziel changed the title Use Card instead of Panel for BlockEditorPanel Use Card instead of Panel for BlockEditorArea Jun 2, 2020
@adamziel adamziel changed the title Use Card instead of Panel for BlockEditorArea Use Card instead of Panel for the block editor Jun 2, 2020
<CardHeader className="edit-navigation-menu-editor__block-editor-panel-header">
{ __( 'Navigation menu' ) }
</CardHeader>
<CardBody>
<div className="components-panel__header-actions">
<Button isPrimary onClick={ saveBlocks }>
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 it would make sense to put the <Button> component up within the <CardHeader> component, and maybe position it to the right-side of the header.

<CardHeader className="edit-navigation-menu-editor__block-editor-panel-header">
{ __( 'Navigation menu' ) }
</CardHeader>
<CardBody>
<div className="components-panel__header-actions">
Copy link
Contributor

@shaunandrews shaunandrews Jun 2, 2020

Choose a reason for hiding this comment

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

Whats the purpose of this .components-panel__header-actions element?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's all gone now

@adamziel
Copy link
Contributor Author

adamziel commented Jun 3, 2020

@shaunandrews while I was at it, I also moved the delete link to the top:

Zrzut ekranu 2020-06-3 o 13 36 42

@draganescu
Copy link
Contributor

Feel free to ignore me, but that delete link at the top looks like an important message, a red thing at the top is panicky, and can be hit instead of save.

@adamziel
Copy link
Contributor Author

adamziel commented Jun 3, 2020

Hm, good call. I'll move it back to the bottom for now and let's have a separate discussion about that. On the existing nav-menus screen it is actually at the bottom together with a second Save button:

Zrzut ekranu 2020-06-3 o 14 31 29

@adamziel
Copy link
Contributor Author

adamziel commented Jun 3, 2020

This is the latest version:

Zrzut ekranu 2020-06-3 o 14 37 27

@shaunandrews
Copy link
Contributor

I don’t think we need a duplicate save button at the bottom.

@adamziel
Copy link
Contributor Author

adamziel commented Jun 3, 2020

@shaunandrews Some additional context is that one of the next action items for this screen is adding a switch between horizontal and vertical mode of displaying the menu and the save button at the bottom could be useful in the vertical mode. If you still recommending removing it, I'll do it - just LMK.

@shaunandrews
Copy link
Contributor

Yes let’s remove the bottom button. Thanks.

@adamziel adamziel force-pushed the update/replace-menu-editor-area-with-card branch from c6a7912 to e5a625e Compare June 3, 2020 14:54
@adamziel
Copy link
Contributor Author

adamziel commented Jun 3, 2020

@shaunandrews @draganescu This is ready for a re-review now.

Zrzut ekranu 2020-06-3 o 16 55 44

@draganescu draganescu merged commit fc28252 into master Jun 4, 2020
@draganescu draganescu deleted the update/replace-menu-editor-area-with-card branch June 4, 2020 16:30
@github-actions github-actions bot added this to the Gutenberg 8.3 milestone Jun 4, 2020
display: flex;
align-items: center;
justify-content: space-between;
}
Copy link
Contributor

@youknowriad youknowriad Jun 4, 2020

Choose a reason for hiding this comment

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

should these be bundled in the Card component or not? Genuinely asking, I don't have the answer but if I understand properly when we find ourselves doing this kind of override (which we do often), maybe we're missing something in the abstraction. cc @ItsJonQ

Copy link

Choose a reason for hiding this comment

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

Thanks for the heads up @youknowriad !

We recently merged in an update that added a new layout-based component, <Flex />, that handles this very use-case!

https://github.com/WordPress/gutenberg/tree/master/packages/components/src/flex

I can update the <Card /> sub-components to use <Flex />, which should save us from having to write CSS like this in future use

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