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

List View: Hack back in a border color for the list view drop indicator #54712

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
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
Expand All @@ -7,6 +12,7 @@ import { useCallback, useMemo } from '@wordpress/element';
import { isRTL } from '@wordpress/i18n';

export default function ListViewDropIndicator( {
dropIndicatorClassName,
listViewRef,
blockDropTarget,
} ) {
Expand Down Expand Up @@ -243,7 +249,10 @@ export default function ListViewDropIndicator( {
animate={ false }
anchor={ popoverAnchor }
focusOnMount={ false }
className="block-editor-list-view-drop-indicator"
className={ classnames(
'block-editor-list-view-drop-indicator',
dropIndicatorClassName
) }
variant="unstyled"
>
<div
Expand Down
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/list-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
* @param {Object} props Components props.
* @param {string} props.id An HTML element id for the root element of ListView.
* @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.
* @param {string} props.dropIndicatorClassName Class name to be used for the drop indicator.
* @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.
* @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.
* @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.
* @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.
* @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.
* @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.
* @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.}
* @param {string} props.description Optional accessible description for the tree grid component.
* @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.
* @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.
Expand All @@ -75,6 +76,7 @@ function ListViewComponent(
{
id,
blocks,
dropIndicatorClassName,
dropZoneElement,
showBlockMovers = false,
isExpanded = false,
Expand Down Expand Up @@ -256,6 +258,7 @@ function ListViewComponent(
return (
<AsyncModeProvider value={ true }>
<ListViewDropIndicator
dropIndicatorClassName={ dropIndicatorClassName }
listViewRef={ elementRef }
blockDropTarget={ blockDropTarget }
/>
Expand Down
8 changes: 7 additions & 1 deletion packages/block-editor/src/components/list-view/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
padding: 0;
margin: 0;

* {
box-sizing: border-box;
}

// Move upwards when in modal.
.components-modal__content & {
margin: (-$grid-unit-15) (-$grid-unit-15 * 0.5) 0;
Expand Down Expand Up @@ -431,8 +435,10 @@ $block-navigation-max-indent: 8;
pointer-events: none;

.block-editor-list-view-drop-indicator__line {
box-sizing: border-box;
background: var(--wp-admin-theme-color);
height: 4px;
height: 6px;
border: 1px solid $white;
border-radius: 4px;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default function NavigationMenuContent( { rootClientId } ) {
<>
{ ! isLoading && (
<PrivateListView
dropIndicatorClassName="edit-site-sidebar-navigation-screen-navigation-menus__list-view-drop-indicator"
rootClientId={ listViewRootClientId }
onSelect={ offCanvasOnselect }
blockSettingsMenu={ LeafMoreMenu }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@
.edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor {
display: none;
}


.edit-site-sidebar-navigation-screen-navigation-menus__list-view-drop-indicator {
.block-editor-list-view-drop-indicator__line {
border: 1px solid $gray-900 !important;
}
}
Loading