From 05a341abba137da3ccc0b235ae8457fddcd2cb16 Mon Sep 17 00:00:00 2001 From: juah255 Date: Mon, 30 Mar 2026 13:21:41 +0600 Subject: [PATCH 1/3] Use theme-aware background in DataViews and SkeletonTable Replace hardcoded bg-white with bg-background CSS variable so DataViews table and skeleton loader respect the active theme. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/wordpress/dataviews.tsx | 8 ++++---- src/components/wordpress/style.css | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/wordpress/dataviews.tsx b/src/components/wordpress/dataviews.tsx index c328d99..d336b8b 100644 --- a/src/components/wordpress/dataviews.tsx +++ b/src/components/wordpress/dataviews.tsx @@ -386,9 +386,9 @@ function SkeletonTable({ return ( - + {hasBulkActions && ( - )} @@ -398,7 +398,7 @@ function SkeletonTable({ {Array.from({ length: rows }, (_, rowIdx) => ( - + {hasBulkActions && (
+ {label} @@ -409,7 +409,7 @@ function SkeletonTable({
diff --git a/src/components/wordpress/style.css b/src/components/wordpress/style.css index 0158ea7..aff9d4a 100644 --- a/src/components/wordpress/style.css +++ b/src/components/wordpress/style.css @@ -65,6 +65,7 @@ display: flex; justify-content: space-between !important; padding: 16px; + background-color: var(--background, #FFFFFF); } .pui-root-dataviews .dataviews-wrapper .dataviews-view-table tr td:first-child, .pui-root-dataviews .dataviews-wrapper .dataviews-view-table tr th:first-child { From 0e4186bfd468a001bbef4d6f27d584f3778dc06b Mon Sep 17 00:00:00 2001 From: Kamruzzaman Date: Tue, 31 Mar 2026 10:20:10 +0600 Subject: [PATCH 2/3] Refactor PosterGrid component and enhance theme-aware background styles in DataViews --- .../wordpress/DataViews.stories.tsx | 75 +++---------------- src/components/wordpress/style.css | 6 +- 2 files changed, 14 insertions(+), 67 deletions(-) diff --git a/src/components/wordpress/DataViews.stories.tsx b/src/components/wordpress/DataViews.stories.tsx index 947a66f..f99a59f 100644 --- a/src/components/wordpress/DataViews.stories.tsx +++ b/src/components/wordpress/DataViews.stories.tsx @@ -959,80 +959,24 @@ FullFeatured.storyName = "Full Featured"; */ function PosterGrid({ items }: { items: User[] }) { return ( -
+
{items.map((item) => (
-
-

+
+

{item.name}

-

+

{item.email}

-
- +
+ {item.role} - + {item.status}
@@ -1083,9 +1027,8 @@ export const LayoutCustomComponent: StoryFn = () => { view={view} fields={fields} onChangeView={setView} - defaultLayouts={{ table: {} }} > -
+
{DataViews.Search && }
diff --git a/src/components/wordpress/style.css b/src/components/wordpress/style.css index aff9d4a..593eb4e 100644 --- a/src/components/wordpress/style.css +++ b/src/components/wordpress/style.css @@ -3,15 +3,19 @@ @import "@wordpress/dataviews/build-style/style.css"; @import '@wordpress/theme/design-tokens.css'; +.pui-root-dataviews, +.pui-root-dataviews .dataviews-wrapper { + background-color: var(--background, #FFFFFF); +} .pui-root-dataviews:not(.custom-layout) { border-radius: 6px; border: 1px solid var(--border, #E7E7E7); box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843); - background-color: var(--background, #FFFFFF); color: var(--foreground, #1D1D1D); } .pui-root-dataviews .dataviews-no-results { border-top: 1px solid var(--border, #E7E7E7); + background-color: var(--background, #FFFFFF); } .pui-root-dataviews:not(.custom-layout) .dataviews-wrapper { border-radius: 6px; From 29ae7ebbd2be9e1513e4edbc8e709a9c54bffb37 Mon Sep 17 00:00:00 2001 From: Kamruzzaman Date: Tue, 31 Mar 2026 11:05:57 +0600 Subject: [PATCH 3/3] Enhance user data generation with first and last names, improve SkeletonTable rendering for grid and list views, and add vertical alignment to table cells --- .../wordpress/DataViews.stories.tsx | 35 +++++++++++---- src/components/wordpress/dataviews.tsx | 45 +++++++++++++++++-- src/components/wordpress/style.css | 1 + 3 files changed, 68 insertions(+), 13 deletions(-) diff --git a/src/components/wordpress/DataViews.stories.tsx b/src/components/wordpress/DataViews.stories.tsx index f99a59f..bdcbee2 100644 --- a/src/components/wordpress/DataViews.stories.tsx +++ b/src/components/wordpress/DataViews.stories.tsx @@ -17,18 +17,35 @@ interface User { } // Generate sample data +const firstNames = [ + "James", "Emma", "Liam", "Olivia", "Noah", "Ava", "William", "Sophia", + "Benjamin", "Isabella", "Lucas", "Mia", "Henry", "Charlotte", "Alexander", + "Amelia", "Daniel", "Harper", "Matthew", "Evelyn", "Sebastian", "Aria", + "Jack", "Chloe", "Owen", +]; +const lastNames = [ + "Anderson", "Martinez", "Thompson", "Garcia", "Robinson", "Clark", "Lewis", + "Walker", "Hall", "Young", "King", "Wright", "Lopez", "Hill", "Scott", + "Green", "Adams", "Baker", "Nelson", "Carter", "Mitchell", "Perez", + "Roberts", "Turner", "Phillips", +]; + const generateUsers = (count: number): User[] => { const statuses: User["status"][] = ["active", "inactive", "pending"]; const roles = ["Admin", "Editor", "Viewer", "Manager"]; - - return Array.from({ length: count }, (_, i) => ({ - id: `user-${i + 1}`, - name: `User ${i + 1}`, - email: `user${i + 1}@example.com`, - status: statuses[i % 3], - role: roles[i % 4], - joinedAt: new Date(2024, i % 12, (i % 28) + 1).toLocaleDateString(), - })); + + return Array.from({ length: count }, (_, i) => { + const first = firstNames[i % firstNames.length]; + const last = lastNames[i % lastNames.length]; + return { + id: `user-${i + 1}`, + name: `${first} ${last}`, + email: `${first.toLowerCase()}.${last.toLowerCase()}@example.com`, + status: statuses[i % 3], + role: roles[i % 4], + joinedAt: new Date(2024, i % 12, (i % 28) + 1).toLocaleDateString(), + }; + }); }; const allUsers = generateUsers(100); diff --git a/src/components/wordpress/dataviews.tsx b/src/components/wordpress/dataviews.tsx index d336b8b..220000a 100644 --- a/src/components/wordpress/dataviews.tsx +++ b/src/components/wordpress/dataviews.tsx @@ -228,7 +228,7 @@ const FilterItems = ({ return ( -
+
{activeFilters.map((id) => { const field = fields.find((f) => f.id === id); @@ -368,19 +368,55 @@ const ListEmpty = ({ icon, description, title }: ListEmptyProps) => { }; /** - * Renders a skeleton table with real column headers and animated placeholder rows. + * Renders a skeleton loading state matching the current view type. */ function SkeletonTable({ rows, headers, hasActions, - hasBulkActions + hasBulkActions, + viewType = 'table' }: { rows: number; headers: string[]; hasActions: boolean; hasBulkActions: boolean; + viewType?: string; }) { + if (viewType === 'grid') { + return ( +
+ {Array.from({ length: rows }, (_, i) => ( +
+ + + +
+ + +
+
+ ))} +
+ ); + } + + if (viewType === 'list') { + return ( +
+ {Array.from({ length: rows }, (_, i) => ( +
+
+ + +
+ {hasActions && } +
+ ))} +
+ ); + } + const widths = ['w-3/4', 'w-1/2', 'w-2/3', 'w-5/6', 'w-2/5']; return ( @@ -710,7 +746,7 @@ export function DataViews(props: DataViewsProps) { {header &&
{header}
}
@@ -796,6 +832,7 @@ export function DataViews(props: DataViewsProps) { )} {isLoading ? (