From 3fb8ef7101fa57f449de523137ae6263a73b8612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:48:35 +0100 Subject: [PATCH] If there is only one action and is primary, hide the actions menu --- .../src/dataviews-layouts/list/index.tsx | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/packages/dataviews/src/dataviews-layouts/list/index.tsx b/packages/dataviews/src/dataviews-layouts/list/index.tsx index a4f94e482c69b3..72dd97c3e1dadf 100644 --- a/packages/dataviews/src/dataviews-layouts/list/index.tsx +++ b/packages/dataviews/src/dataviews-layouts/list/index.tsx @@ -175,6 +175,8 @@ function ListItem< Item >( { }; }, [ actions, item ] ); + const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; + const renderedMediaField = mediaField?.render ? (
@@ -194,33 +196,35 @@ function ListItem< Item >( { item={ item } /> ) } -
- - } + { ! hasOnlyOnePrimaryAction && ( +
+ + } + /> + } + placement="bottom-end" + > + - } - placement="bottom-end" - > - - -
+
+
+ ) } );