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

Reveal block boundaries on hover in the Site Editor #27271

Merged
merged 16 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@

// Active entity spotlight.
&.has-active-entity:not(.is-focus-mode) {
opacity: 0.5;
Copy link
Member

Choose a reason for hiding this comment

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

If we are removing the template part spotlight mode thingy, we can probably remove this class entry altogether

//opacity: 0.5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably need to remove this when this PR goes out of draft state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably 😅

transition: opacity 0.1s linear;
@include reduce-motion("transition");

Expand Down
74 changes: 52 additions & 22 deletions packages/block-library/src/template-part/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,65 @@
}
}

.block-editor-block-list__block[data-type="core/template-part"] {
&.is-selected,
&.has-child-selected {
&::after {
top: $border-width;
bottom: $border-width;
left: $border-width;
right: $border-width;
border-radius: $radius-block-ui - $border-width; // Border is outset, so so subtract the width to achieve correct radius.
.block-editor-block-list__layout {
.block-editor-block-list__block[data-type="core/template-part"] {
&.is-selected,
&.has-child-selected {
&::after {
top: $border-width;
bottom: $border-width;
left: $border-width;
right: $border-width;
border-radius: $radius-block-ui - $border-width; // Border is outset, so so subtract the width to achieve correct radius.
}
}

&.is-hovered {
&::after, {
// 2px outside.
box-shadow: 0 0 0 $border-width $alert-red;
// Show a light color for dark themes.
.is-dark-theme & {
box-shadow: 0 0 0 $border-width $dark-theme-focus;
}
}
}
}

&.is-selected {
&::after {
// 2px outside.
box-shadow: 0 0 0 $border-width-focus var(--wp-admin-theme-color);
// Show a light color for dark themes.
.is-dark-theme & {
box-shadow: 0 0 0 $border-width-focus $dark-theme-focus;
&.is-selected,
&:focus {
&::after, {
// 2px outside.
box-shadow: 0 0 0 $border-width-focus $alert-red;
// Show a light color for dark themes.
.is-dark-theme & {
box-shadow: 0 0 0 $border-width-focus $dark-theme-focus;
}
}
}

/*&.has-child-selected {
&::after {
box-shadow: 0 0 0 $border-width $gray-300;

.is-dark-theme & {
box-shadow: 0 0 0 $border-width-focus $gray-700;
}
}
}*/
}

&.has-child-selected {
&::after {
box-shadow: 0 0 0 $border-width $gray-300;
&.edit-site-block-editor__block-list {
.is-hovered {
&::after {
box-shadow: 0 0 0 $border-width $gray-900;
}
}

.is-dark-theme & {
box-shadow: 0 0 0 $border-width-focus $gray-700;
.block-editor-rich-text__editable {
&.is-selected.is-hovered {
&::after {
box-shadow: none;
}
}
}
}
Expand Down