Refactor background style

This commit is contained in:
Maximilian Harz 2025-02-10 22:55:20 +01:00
parent f71929b4d8
commit aa616ed295

View File

@ -42,6 +42,12 @@ export function ActionButton({
.filter((i) => !existingRelations.some((s) => s.id === i.id)) .filter((i) => !existingRelations.some((s) => s.id === i.id))
.filter((i) => i.id !== item.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 ( return (
<> <>
{hasUserPermission(collection, 'update', item) && ( {hasUserPermission(collection, 'update', item) && (
@ -55,7 +61,7 @@ export function ActionButton({
setModalOpen(true) setModalOpen(true)
}} }}
style={{ style={{
backgroundColor: `${(item.color ?? (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color)) ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`, backgroundColor,
color: '#fff', color: '#fff',
}} }}
> >
@ -79,7 +85,7 @@ export function ActionButton({
triggerAddButton() triggerAddButton()
}} }}
style={{ style={{
backgroundColor: `${item.color ?? (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor)}`, backgroundColor,
color: '#fff', color: '#fff',
}} }}
> >