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

Move the Block Patterns UI to the inserter #20951

Merged
merged 41 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
15947be
Move the Block Patterns UI to the inserter
youknowriad Mar 17, 2020
377a533
Restore the patterns panel gray background
youknowriad Apr 1, 2020
8c6bd6c
Redesign search form and tabs
youknowriad Apr 2, 2020
5be21ae
Redesign the inserter panels and resize it
youknowriad Apr 2, 2020
c2759c7
Redesign the preview panel
youknowriad Apr 2, 2020
726d374
Try using a panel instead of a dropdown
youknowriad Apr 10, 2020
f7b8f3e
Use a popover for the block preview
youknowriad Apr 10, 2020
60345c1
User a border to separate the tips from the rest
youknowriad Apr 10, 2020
962ecac
Rename block patterns to just patterns
youknowriad Apr 10, 2020
7360585
design tweaks
youknowriad Apr 10, 2020
b6050c4
update the search focus style
youknowriad Apr 10, 2020
3a819ea
better spacing
youknowriad Apr 10, 2020
4404f05
Mutually exclusive sidebars
youknowriad Apr 10, 2020
d364be4
Fix the inserter toggle
youknowriad Apr 10, 2020
28e290b
Remove duplicate region
youknowriad Apr 10, 2020
06dc586
Use a fixed position for the block preview
youknowriad Apr 14, 2020
487d704
Disable search autocomplete
youknowriad Apr 14, 2020
dc99c37
Style tweaks
youknowriad Apr 14, 2020
f693957
Disable auto closing sidebars on large screens
youknowriad Apr 14, 2020
723671a
Simplify the patterns design further
youknowriad Apr 14, 2020
815b767
Only show the child blocks once
youknowriad Apr 14, 2020
9ae4b64
Add an aria label to the patterns
youknowriad Apr 14, 2020
33854a3
Try adding focus styles
youknowriad Apr 15, 2020
abe06ce
Fix unit tests
youknowriad Apr 15, 2020
74b4c56
Fix e2e tests
youknowriad Apr 16, 2020
ae5a59f
Animate the inserter
youknowriad Apr 16, 2020
1a44e48
border radius fixes
youknowriad Apr 16, 2020
d038154
Add close button on mobile
youknowriad Apr 16, 2020
95ae982
remove tab stop from the inserter
youknowriad Apr 17, 2020
3ef11eb
Rename the left sidebar label
youknowriad Apr 17, 2020
4789706
fix translator comments
youknowriad Apr 17, 2020
2430ecc
fix isPressed buttons hover styles
youknowriad Apr 17, 2020
43fa8a0
More translator comments for the inserter tabs
youknowriad Apr 17, 2020
78fea84
Remove the animation and fix e2e test
youknowriad Apr 17, 2020
0dec075
Remove useless div
youknowriad Apr 17, 2020
911a5f4
Improve preview
youknowriad Apr 17, 2020
828b44c
Center blocks by default
youknowriad Apr 17, 2020
ea6a344
Smaller breakpoint for the mutually exclusive sidebar closing
youknowriad Apr 17, 2020
276188f
tweak tab styles
youknowriad Apr 17, 2020
a91a671
Fix toolbar hover styles
youknowriad Apr 17, 2020
3868f57
Revert "Smaller breakpoint for the mutually exclusive sidebar closing"
youknowriad Apr 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/designers-developers/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<dt>Block name</dt>
<dd>A unique identifier for a block type, consisting of a plugin-specific namespace and a short label describing the block's intent. e.g. <code>core/image</code></dd>

<dt>Block patterns</dt>
<dd>Block patterns are predefined layouts of blocks that can be inserted as starter content that are meant to be changed by the user every time. Once inserted, they exist as a local save and are not global.</dd>
<dt>Patterns</dt>
<dd>Patterns are predefined layouts of blocks that can be inserted as starter content that are meant to be changed by the user every time. Once inserted, they exist as a local save and are not global.</dd>

<dt>Block type</dt>
<dd>In contrast with the blocks composing a particular post, a block type describes the blueprint by which any block of that type should behave. So while there may be many images within a post, each behaves consistent with a unified image block type definition.</dd>
Expand Down
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ function gutenberg_load_block_pattern( $name ) {
}

/**
* Extends block editor settings to include a list of default block patterns.
* Extends block editor settings to include a list of default patterns.
*
* @param array $settings Default editor settings.
*
Expand Down
1 change: 1 addition & 0 deletions packages/base-styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ $grid-unit-60: 6 * $grid-unit; // 48px
* Dimensions.
*/

$icon-size: 24px;
$button-size: 36px;
$button-size-small: 24px;
$panel-padding: 16px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
justify-content: center;
background: transparent;
word-break: break-word;
border-radius: $radius-round-rectangle;
border-radius: $radius-block-ui;
border: $border-width solid $light-gray-500;
transition: all 0.05s ease-in-out;
@include reduce-motion("transition");
Expand Down
9 changes: 7 additions & 2 deletions packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.block-editor-block-list__block {
margin-left: auto;
margin-right: auto;
}

.block-editor-block-list__layout .block-editor-block-list__block { // Needs specificity to override inherited styles.
// While block is being dragged, dim the slot dragged from, and hide some UI.
&.is-dragging {
Expand Down Expand Up @@ -608,6 +613,8 @@
// The purpose of this padding is to ensure that on small viewports, there is
// room for the block border that sits 14px ($block-padding) offset from the
// block footprint.
// These paddings and margins are removed from the BlockPreview component's style
// Any change need to be reflected there.
.block-editor-block-list__layout.is-root-container {
padding-left: $block-padding;
padding-right: $block-padding;
Expand All @@ -616,9 +623,7 @@
padding-left: $block-side-ui-width;
padding-right: $block-side-ui-width;
}
}

.block-editor-block-list__layout.is-root-container {
// Full-wide. (to account for the padddings added above)
// The first two rules account for the alignment wrapper div for the image block.
> div:not(.block-editor-block-list__block) > .block-editor-block-list__block[data-align="full"],
Expand Down
40 changes: 0 additions & 40 deletions packages/block-editor/src/components/block-patterns/style.scss

This file was deleted.

1 change: 0 additions & 1 deletion packages/block-editor/src/components/block-preview/auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function AutoBlockPreview( { viewportWidth, __experimentalPadding } ) {
aria-hidden
style={ {
height: contentHeight * scale + 2 * __experimentalPadding,
padding: __experimentalPadding,
} }
>
{ containerResizeListener }
Expand Down
15 changes: 15 additions & 0 deletions packages/block-editor/src/components/block-preview/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,19 @@
.block-list-appender {
display: none;
}

// Reset default editor padding
.block-editor-block-list__layout.is-root-container {
padding-left: 0;
padding-right: 0;

> div:not(.block-editor-block-list__block) > .block-editor-block-list__block[data-align="full"],
> div:not(.block-editor-block-list__block) > .block-editor-block-list__block.alignfull,
> .block-editor-block-list__block[data-align="full"],
> .block-editor-block-list__block.alignfull {
margin-left: 0;
margin-right: 0;
}
}
}

4 changes: 2 additions & 2 deletions packages/block-editor/src/components/block-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
flex-shrink: 0;
cursor: pointer;
overflow: hidden;
border-radius: $radius-round-rectangle;
border-radius: $radius-block-ui;
padding: $grid-unit-05 * 1.5;
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -42,7 +42,7 @@
outline: $border-width solid transparent; // Shown in Windows High Contrast mode.
padding: 0;
border: $border-width solid rgba($dark-gray-primary, 0.2);
border-radius: $radius-round-rectangle;
border-radius: $radius-block-ui;
display: flex;
overflow: hidden;
background: $white;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export { default as BlockFormatControls } from './block-format-controls';
export { default as BlockIcon } from './block-icon';
export { default as BlockNavigationDropdown } from './block-navigation/dropdown';
export { default as __experimentalBlockNavigationList } from './block-navigation/list';
export { default as __experimentalBlockPatterns } from './block-patterns';
export { default as __experimentalBlockVariationPicker } from './block-variation-picker';
export { default as BlockVerticalAlignmentToolbar } from './block-vertical-alignment-toolbar';
export { default as ButtonBlockerAppender } from './button-block-appender';
Expand Down Expand Up @@ -74,6 +73,7 @@ export { default as CopyHandler } from './copy-handler';
export { default as DefaultBlockAppender } from './default-block-appender';
export { default as __unstableEditorStyles } from './editor-styles';
export { default as Inserter } from './inserter';
export { default as __experimentalLibrary } from './inserter/library';
export { default as BlockEditorKeyboardShortcuts } from './keyboard-shortcuts';
export { default as MultiSelectScrollIntoView } from './multi-select-scroll-into-view';
export { default as NavigableToolbar } from './navigable-toolbar';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: block;
width: 33.33%;
padding: 0;
margin: 0 0 12px;
margin: 0;
}

.components-button.block-editor-block-types-list__item {
Expand All @@ -11,13 +11,13 @@
width: 100%;
font-size: $default-font-size;
color: $dark-gray-700;
padding: 0 4px;
padding: $grid-unit-10;
align-items: stretch;
justify-content: center;
cursor: pointer;
background: transparent;
word-break: break-word;
border-radius: $radius-round-rectangle;
border-radius: $radius-block-ui;
border: $border-width solid transparent;
transition: all 0.05s ease-in-out;
@include reduce-motion("transition");
Expand Down Expand Up @@ -48,7 +48,7 @@

.block-editor-block-types-list__item-icon {
padding: 12px 20px;
border-radius: $radius-round-rectangle;
border-radius: $radius-block-ui;
color: $dark-gray-primary;
transition: all 0.05s ease-in-out;
@include reduce-motion("transition");
Expand All @@ -66,4 +66,5 @@

.block-editor-block-types-list__item-title {
padding: 4px 2px 8px;
font-size: 12px;
}
Loading