From aa616ed2952741121c319a3756b8ce9a50b54c77 Mon Sep 17 00:00:00 2001 From: Maximilian Harz Date: Mon, 10 Feb 2025 22:55:20 +0100 Subject: [PATCH] Refactor background style --- src/Components/Profile/Subcomponents/ActionsButton.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Components/Profile/Subcomponents/ActionsButton.tsx b/src/Components/Profile/Subcomponents/ActionsButton.tsx index 0c991ae6..f261dfb7 100644 --- a/src/Components/Profile/Subcomponents/ActionsButton.tsx +++ b/src/Components/Profile/Subcomponents/ActionsButton.tsx @@ -42,6 +42,12 @@ export function ActionButton({ .filter((i) => !existingRelations.some((s) => s.id === i.id)) .filter((i) => i.id !== item.id) + const backgroundColor = + item.color ?? + (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color + ? getItemTags(item)[0].color + : item.layer?.markerDefaultColor) + return ( <> {hasUserPermission(collection, 'update', item) && ( @@ -55,7 +61,7 @@ export function ActionButton({ setModalOpen(true) }} style={{ - backgroundColor: `${(item.color ?? (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color)) ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`, + backgroundColor, color: '#fff', }} > @@ -79,7 +85,7 @@ export function ActionButton({ triggerAddButton() }} style={{ - backgroundColor: `${item.color ?? (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor)}`, + backgroundColor, color: '#fff', }} >