diff --git a/packages/dataviews/src/components/dataviews-view-config/index.tsx b/packages/dataviews/src/components/dataviews-view-config/index.tsx index c8b26c51275891..c1de8c9762fab0 100644 --- a/packages/dataviews/src/components/dataviews-view-config/index.tsx +++ b/packages/dataviews/src/components/dataviews-view-config/index.tsx @@ -2,6 +2,7 @@ * External dependencies */ import type { ChangeEvent } from 'react'; +import clsx from 'clsx'; /** * WordPress dependencies @@ -25,8 +26,15 @@ import { BaseControl, } from '@wordpress/components'; import { __, _x, sprintf } from '@wordpress/i18n'; -import { memo, useContext, useMemo } from '@wordpress/element'; -import { chevronDown, chevronUp, cog, seen, unseen } from '@wordpress/icons'; +import { memo, useContext, useMemo, useState } from '@wordpress/element'; +import { + chevronDown, + chevronUp, + cog, + seen, + unseen, + moreVertical, +} from '@wordpress/icons'; import warning from '@wordpress/warning'; import { useInstanceId } from '@wordpress/compose'; @@ -37,6 +45,7 @@ import { SORTING_DIRECTIONS, LAYOUT_GRID, LAYOUT_TABLE, + LAYOUT_LIST, sortIcons, sortLabels, } from '../../constants'; @@ -239,6 +248,47 @@ function ItemsPerPageControl() { ); } +function BaseFieldItem( { + label, + subLabel, + actions, + isInteracting, +}: { + label: string; + subLabel?: string; + actions: React.ReactNode; + isInteracting?: boolean; +} ) { + return ( + + +
+ + { label } + + { subLabel && ( + + { subLabel } + + ) } +
+ + { actions } + +
+
+ ); +} + interface FieldItemProps { id: any; label: string; @@ -261,17 +311,10 @@ function FieldItem( { const visibleFieldIds = getVisibleFieldIds( view, fields ); return ( - - - { label } - + { view.type === LAYOUT_TABLE && isVisible && ( <>