mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02:00
Chore/constraint value styling (#9853)
Fixes a few small styling issues with the constraint value chips: - Background color was wrong - They shouldn't have a border when they're not focused Different styles: 1. Keyboard focus 2. Mouse hover 3. No focus 4. No focus 5. Add values button for reference. <img width="405" alt="image" src="https://github.com/user-attachments/assets/ded98393-a7a8-4d4a-81ff-63a3f4d32184" />
This commit is contained in:
parent
1b031c9caf
commit
20a259fc4a
@ -9,8 +9,10 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { parseParameterStrings } from 'utils/parseParameter';
|
import { parseParameterStrings } from 'utils/parseParameter';
|
||||||
|
import { baseChipStyles } from './ValueList';
|
||||||
|
|
||||||
const AddValuesButton = styled('button')(({ theme }) => ({
|
const AddValuesButton = styled('button')(({ theme }) => ({
|
||||||
|
...baseChipStyles(theme),
|
||||||
color: theme.palette.primary.main,
|
color: theme.palette.primary.main,
|
||||||
svg: {
|
svg: {
|
||||||
fill: theme.palette.primary.main,
|
fill: theme.palette.primary.main,
|
||||||
@ -26,13 +28,7 @@ const AddValuesButton = styled('button')(({ theme }) => ({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
padding: theme.spacing(0.5, 1.5, 0.5, 1.5),
|
padding: theme.spacing(0.5, 1.5, 0.5, 1.5),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
transition: 'all 0.3s ease',
|
cursor: 'pointer',
|
||||||
outline: `1px solid #0000`,
|
|
||||||
background: theme.palette.background.elevation1,
|
|
||||||
':hover, :focus-visible': {
|
|
||||||
background: theme.palette.background.elevation1,
|
|
||||||
outlineColor: theme.palette.secondary.dark,
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledPopover = styled(Popover)(({ theme }) => ({
|
const StyledPopover = styled(Popover)(({ theme }) => ({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Clear from '@mui/icons-material/Clear';
|
import Clear from '@mui/icons-material/Clear';
|
||||||
import { Chip, type ChipProps, styled } from '@mui/material';
|
import { Chip, type ChipProps, styled, type Theme } from '@mui/material';
|
||||||
import { type FC, forwardRef, type PropsWithChildren, useRef } from 'react';
|
import { type FC, forwardRef, type PropsWithChildren, useRef } from 'react';
|
||||||
|
|
||||||
const ValueListWrapper = styled('div')(({ theme }) => ({
|
const ValueListWrapper = styled('div')(({ theme }) => ({
|
||||||
@ -14,16 +14,26 @@ const StyledList = styled('ul')({
|
|||||||
display: 'contents',
|
display: 'contents',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const baseChipStyles = (theme: Theme) => ({
|
||||||
|
':hover': { background: theme.palette.secondary.light },
|
||||||
|
':focus-visible': {
|
||||||
|
background: theme.palette.background.elevation1,
|
||||||
|
outlineColor: theme.palette.secondary.dark,
|
||||||
|
},
|
||||||
|
background: theme.palette.background.elevation1,
|
||||||
|
color: theme.palette.text.primary,
|
||||||
|
height: 'auto',
|
||||||
|
outline: `1px solid #0000`,
|
||||||
|
transition: 'all 0.3s ease',
|
||||||
|
});
|
||||||
|
|
||||||
const ValueChipBase = styled(
|
const ValueChipBase = styled(
|
||||||
forwardRef<HTMLDivElement, ChipProps>((props, ref) => (
|
forwardRef<HTMLDivElement, ChipProps>((props, ref) => (
|
||||||
<Chip size='small' {...props} ref={ref} />
|
<Chip size='small' {...props} ref={ref} />
|
||||||
)),
|
)),
|
||||||
)(({ theme }) => ({
|
)(({ theme }) => ({
|
||||||
transition: 'all 0.3s ease',
|
...baseChipStyles(theme),
|
||||||
outline: `1px solid #0000`,
|
color: theme.palette.text.primary,
|
||||||
background: theme.palette.secondary.light,
|
|
||||||
color: theme.palette.secondary.dark,
|
|
||||||
border: `1px solid ${theme.palette.secondary.border}`,
|
|
||||||
padding: 0,
|
padding: 0,
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
'& .MuiChip-label': {
|
'& .MuiChip-label': {
|
||||||
@ -34,12 +44,6 @@ const ValueChipBase = styled(
|
|||||||
'& .MuiChip-deleteIcon': {
|
'& .MuiChip-deleteIcon': {
|
||||||
marginRight: theme.spacing(1),
|
marginRight: theme.spacing(1),
|
||||||
},
|
},
|
||||||
':hover, :focus-visible': {
|
|
||||||
background: theme.palette.secondary.light,
|
|
||||||
},
|
|
||||||
':focus-visible': {
|
|
||||||
outlineColor: theme.palette.secondary.dark,
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ValueChip = styled(ValueChipBase)(({ theme }) => ({
|
const ValueChip = styled(ValueChipBase)(({ theme }) => ({
|
||||||
|
Loading…
Reference in New Issue
Block a user