Skip to content

Commit

Permalink
Move the Block Patterns UI to the inserter and redesign the inserter (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Apr 17, 2020
1 parent 6074400 commit 5494ff5
Show file tree
Hide file tree
Showing 64 changed files with 836 additions and 702 deletions.
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

0 comments on commit 5494ff5

Please sign in to comment.