Skip to content

Commit

Permalink
Use Badge component in dataview grids. (#68062)
Browse files Browse the repository at this point in the history
Co-authored-by: juanfra <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: jameskoster <[email protected]>
  • Loading branch information
4 people authored Dec 18, 2024
1 parent 2e3e6e4 commit 174e343
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
7 changes: 5 additions & 2 deletions packages/dataviews/src/dataviews-layouts/grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import {
Spinner,
Flex,
FlexItem,
privateApis as componentsPrivateApis,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useInstanceId } from '@wordpress/compose';

/**
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
import ItemActions from '../../components/dataviews-item-actions';
import DataViewsSelectionCheckbox from '../../components/dataviews-selection-checkbox';
import {
Expand All @@ -35,6 +37,7 @@ import type {
import type { SetSelection } from '../../private-types';
import getClickableItemProps from '../utils/get-clickable-item-props';
import { useUpdatedPreviewSizeOnViewportChange } from './preview-size-picker';
const { Badge } = unlock( componentsPrivateApis );

interface GridItemProps< Item > {
view: ViewGridType;
Expand Down Expand Up @@ -175,12 +178,12 @@ function GridItem< Item >( {
>
{ badgeFields.map( ( field ) => {
return (
<FlexItem
<Badge
key={ field.id }
className="dataviews-view-grid__field-value"
>
<field.render item={ item } />
</FlexItem>
</Badge>
);
} ) }
</HStack>
Expand Down
11 changes: 0 additions & 11 deletions packages/dataviews/src/dataviews-layouts/grid/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,6 @@
&:not(:empty) {
padding-bottom: $grid-unit-15;
}

.dataviews-view-grid__field-value {
width: fit-content;
background: $gray-100;
padding: 0 $grid-unit-10;
min-height: $grid-unit-30;
border-radius: $radius-small;
display: flex;
align-items: center;
font-size: 12px;
}
}
}

Expand Down

1 comment on commit 174e343

@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 174e343.
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/12396321500
📝 Reported issues:

Please sign in to comment.