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

Navigation: Try removing gray blobs. #36809

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
25 changes: 14 additions & 11 deletions packages/block-library/src/navigation/edit/placeholder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { decodeEntities } from '@wordpress/html-entities';
*/

import useNavigationEntities from '../../use-navigation-entities';
import PlaceholderPreview from './placeholder-preview';
import menuItemsToBlocks from '../../menu-items-to-blocks';
import useNavigationMenu from '../../use-navigation-menu';
import useCreateNavigationMenu from '../use-create-navigation-menu';
Expand Down Expand Up @@ -164,13 +163,17 @@ export default function NavigationPlaceholder( {

return (
<>
{ ( ! hasResolvedNavigationMenus || isStillLoading ) && (
<PlaceholderPreview isLoading />
) }
{ hasResolvedNavigationMenus && ! isStillLoading && (
<Placeholder className="wp-block-navigation-placeholder">
<PlaceholderPreview />
<div className="wp-block-navigation-placeholder__controls">
<Placeholder className="wp-block-navigation-placeholder">
<div className="wp-block-navigation-placeholder__controls">
{ ( ! hasResolvedNavigationMenus || isStillLoading ) && (
<div className="wp-block-navigation-placeholder__actions is-loading">
<div className="wp-block-navigation-placeholder__actions__indicator">
<Icon icon={ navigation } />{ ' ' }
{ __( 'Navigation' ) }
</div>
</div>
) }
{ hasResolvedNavigationMenus && ! isStillLoading && (
<div className="wp-block-navigation-placeholder__actions">
<div className="wp-block-navigation-placeholder__actions__indicator">
<Icon icon={ navigation } />{ ' ' }
Expand Down Expand Up @@ -210,9 +213,9 @@ export default function NavigationPlaceholder( {
{ __( 'Start empty' ) }
</Button>
</div>
</div>
</Placeholder>
) }
) }
</div>
</Placeholder>
</>
);
}

This file was deleted.

110 changes: 33 additions & 77 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
}
}


/**
* Colors Selector component
*/
Expand Down Expand Up @@ -179,10 +180,29 @@ $color-control-label-height: 20px;
justify-content: flex-start;
}


/**
* Setup state
*/

// Loading state.
@keyframes loadingpulse {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}

.wp-block-navigation-placeholder__actions.is-loading {
animation: loadingpulse 1s linear infinite;
animation-delay: 0.5s; // avoid animating for fast network responses
}

// Unstyle some inherited placeholder component styles.
.components-placeholder.wp-block-navigation-placeholder {
outline: none;
Expand All @@ -206,87 +226,19 @@ $color-control-label-height: 20px;
.is-selected & {
color: $gray-900;
}
}

// Spinner.
.wp-block-navigation-placeholder .components-spinner {
margin-top: -4px;
margin-left: 4px;
vertical-align: middle;
margin-right: 7px;
}

@keyframes loadingpulse {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}

// Unselected state.
.wp-block-navigation-placeholder__preview {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
width: 100%;
overflow: hidden;

&.is-loading {
animation: loadingpulse 1s linear infinite;
animation-delay: 0.5s; // avoid animating for fast network responses
}

// Style skeleton elements to mostly match the metrics of actual menu items.
// Needs specificity.
.wp-block-navigation-item.wp-block-navigation-item {
position: relative;
min-width: 72px;

&::before {
display: block;
content: "";
border-radius: $radius-block-ui;
background: currentColor;
height: $grid-unit-20;
width: 100%;
}
}

.wp-block-navigation-placeholder__preview-search-icon {
height: $icon-size;
svg {
fill: currentColor;
}
}

.wp-block-navigation-item.wp-block-navigation-item,
.wp-block-navigation-placeholder__preview-search-icon {
opacity: 0.3;
}
// Hide most placeholder content until selected.
.wp-block-navigation-placeholder__actions > * {
display: none;

&:not(.is-loading) {
// Don't show the preview boxes for an empty nav block,
// but be technically present to help size the empty state.
.wp-block-navigation.is-selected & {
.is-selected & {
display: flex;
opacity: 0;
width: 0;
overflow: hidden;
flex-wrap: nowrap;
flex: 0;
}
}

// Hide entirely when vertical.
.wp-block-navigation.is-selected .is-small &,
.wp-block-navigation.is-selected .is-medium & {
display: none;
}
// Always show the block logo.
.wp-block-navigation-placeholder__actions__indicator {
display: flex;
}
}

Expand All @@ -298,10 +250,14 @@ $color-control-label-height: 20px;
box-shadow: inset 0 0 0 $border-width $gray-900;
flex-direction: row;
align-items: center;
display: none;
position: relative;
z-index: 1;

// Unhide actions when selected.
.wp-block-navigation-placeholder__actions > * {
display: flex;
}

// Adjust padding for when shown horizontally.
.is-large & {
padding: $grid-unit-05 $grid-unit-10;
Expand Down