1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-12 01:17:04 +02:00

refactor: colorpicker (#9668)

This PR refactors the color picker so we stick to one set of colors
instead of changing available colors when theme changes. Colors picked
also work in dark theme and is aligned with UX.
This commit is contained in:
Fredrik Strand Oseberg 2025-04-01 12:32:13 +02:00 committed by GitHub
parent c21ed3ed5e
commit c75779e677
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
import type { FC } from 'react';
import { styled, Box, useTheme } from '@mui/material';
import { lightTheme } from 'themes/theme';
interface ITagTypeColorPickerProps {
selectedColor: string;
@ -55,27 +56,33 @@ export const TagTypeColorPicker: FC<ITagTypeColorPickerProps> = ({
color || '#FFFFFF';
const colorOptions: IColorOption[] = [
{ name: 'White', value: theme.palette.common.white },
{
name: 'White',
value: getColorWithFallback(lightTheme.palette.common.white),
},
{
name: 'Green',
value: getColorWithFallback(theme.palette.success.border),
value: getColorWithFallback(lightTheme.palette.success.main),
},
{
name: 'Yellow',
value: getColorWithFallback(theme.palette.warning.border),
value: getColorWithFallback(lightTheme.palette.warning.main),
},
{
name: 'Red',
value: getColorWithFallback(lightTheme.palette.error.main),
},
{ name: 'Red', value: theme.palette.error.main },
{
name: 'Blue',
value: getColorWithFallback(theme.palette.info.border),
value: getColorWithFallback(lightTheme.palette.info.main),
},
{
name: 'Purple',
value: getColorWithFallback(theme.palette.secondary.border),
value: getColorWithFallback(lightTheme.palette.secondary.main),
},
{
name: 'Gray',
value: getColorWithFallback(theme.palette.neutral.border),
value: getColorWithFallback(lightTheme.palette.neutral.main),
},
];