Skip to content

Commit

Permalink
Dataviews: Add: custom views header indication. (#55926)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored Nov 8, 2023
1 parent 9ca6c8f commit fd42f04
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
*/
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
import {
__experimentalItemGroup as ItemGroup,
__experimentalHeading as Heading,
} from '@wordpress/components';
import { useMemo } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -70,20 +74,25 @@ export function useCustomDataViews( type ) {
export default function CustomDataViewsList( { type, activeView, isCustom } ) {
const customDataViews = useCustomDataViews( type );
return (
<ItemGroup>
{ customDataViews.map( ( customViewRecord ) => {
return (
<CustomDataViewItem
key={ customViewRecord.id }
dataviewId={ customViewRecord.id }
isActive={
isCustom === 'true' &&
Number( activeView ) === customViewRecord.id
}
/>
);
} ) }
<AddNewItem type={ type } />
</ItemGroup>
<>
<div className="edit-site-sidebar-navigation-screen-dataviews__group-header">
<Heading level={ 2 }>{ __( 'Custom Views' ) }</Heading>
</div>
<ItemGroup>
{ customDataViews.map( ( customViewRecord ) => {
return (
<CustomDataViewItem
key={ customViewRecord.id }
dataviewId={ customViewRecord.id }
isActive={
isCustom === 'true' &&
Number( activeView ) === customViewRecord.id
}
/>
);
} ) }
<AddNewItem type={ type } />
</ItemGroup>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.edit-site-sidebar-navigation-screen-dataviews__group-header {
margin-top: $grid-unit-40;
h2 {
font-size: 11px;
font-weight: 500;
text-transform: uppercase;
}
}
1 change: 1 addition & 0 deletions packages/edit-site/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
@import "./components/sidebar-navigation-screen-pattern/style.scss";
@import "./components/sidebar-navigation-screen-patterns/style.scss";
@import "./components/sidebar-navigation-screen-template/style.scss";
@import "./components/sidebar-dataviews/style.scss";
@import "./components/site-hub/style.scss";
@import "./components/sidebar-navigation-screen-navigation-menus/style.scss";
@import "./components/site-icon/style.scss";
Expand Down

1 comment on commit fd42f04

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in fd42f04.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6798131543
📝 Reported issues:

Please sign in to comment.