mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +02:00
feat: styling of new add values (#9788)
1. Moved add values to the left. 2. Popover has new styling, as in designs 
This commit is contained in:
parent
d988b61764
commit
9678054116
@ -378,14 +378,15 @@ export const EditableConstraint: FC<Props> = ({
|
|||||||
{localConstraint.caseInsensitive ? 'Aa' : 'A/a'}
|
{localConstraint.caseInsensitive ? 'Aa' : 'A/a'}
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{!input.includes('LEGAL_VALUES') && (
|
||||||
|
<ValueList
|
||||||
|
values={localConstraint.values}
|
||||||
|
removeValue={removeValue}
|
||||||
|
setValues={setValuesWithRecord}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</ConstraintDetails>
|
</ConstraintDetails>
|
||||||
{!input.includes('LEGAL_VALUES') && (
|
|
||||||
<ValueList
|
|
||||||
values={localConstraint.values}
|
|
||||||
removeValue={removeValue}
|
|
||||||
setValues={setValuesWithRecord}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<HtmlTooltip title='Delete constraint' arrow>
|
<HtmlTooltip title='Delete constraint' arrow>
|
||||||
<IconButton type='button' size='small' onClick={onDelete}>
|
<IconButton type='button' size='small' onClick={onDelete}>
|
||||||
|
@ -88,18 +88,19 @@ const StyledPopover = styled(Popover)(({ theme }) => ({
|
|||||||
borderRadius: theme.shape.borderRadiusLarge,
|
borderRadius: theme.shape.borderRadiusLarge,
|
||||||
border: `1px solid ${theme.palette.divider}`,
|
border: `1px solid ${theme.palette.divider}`,
|
||||||
padding: theme.spacing(2),
|
padding: theme.spacing(2),
|
||||||
width: '300px',
|
width: '250px',
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledTextField = styled(TextField)(({ theme }) => ({
|
const StyledTextField = styled(TextField)(({ theme }) => ({
|
||||||
width: '100%',
|
flexGrow: 1,
|
||||||
marginBottom: theme.spacing(1),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ButtonContainer = styled('div')(({ theme }) => ({
|
const InputRow = styled('div')(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'flex-end',
|
gap: theme.spacing(1),
|
||||||
|
alignItems: 'start',
|
||||||
|
width: '100%',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ErrorMessage = styled('div')(({ theme }) => ({
|
const ErrorMessage = styled('div')(({ theme }) => ({
|
||||||
@ -166,39 +167,38 @@ const AddValues = forwardRef<HTMLButtonElement, AddValuesProps>(
|
|||||||
onClose={() => setOpen(false)}
|
onClose={() => setOpen(false)}
|
||||||
anchorOrigin={{
|
anchorOrigin={{
|
||||||
vertical: 'bottom',
|
vertical: 'bottom',
|
||||||
horizontal: 'center',
|
horizontal: 'left',
|
||||||
}}
|
}}
|
||||||
transformOrigin={{
|
transformOrigin={{
|
||||||
vertical: 'top',
|
vertical: 'top',
|
||||||
horizontal: 'center',
|
horizontal: 'left',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<StyledTextField
|
{error && <ErrorMessage>{error}</ErrorMessage>}
|
||||||
label='Values'
|
<InputRow>
|
||||||
placeholder='value1, value2, value3...'
|
<StyledTextField
|
||||||
value={inputValues}
|
placeholder='Enter value'
|
||||||
onChange={(e) => {
|
value={inputValues}
|
||||||
setInputValues(e.target.value);
|
onChange={(e) => {
|
||||||
setError('');
|
setInputValues(e.target.value);
|
||||||
}}
|
setError('');
|
||||||
onKeyPress={handleKeyPress}
|
}}
|
||||||
error={Boolean(error)}
|
onKeyPress={handleKeyPress}
|
||||||
helperText={error}
|
size='small'
|
||||||
size='small'
|
variant='standard'
|
||||||
fullWidth
|
fullWidth
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
<ButtonContainer>
|
|
||||||
<Button
|
<Button
|
||||||
variant='contained'
|
variant='text'
|
||||||
color='primary'
|
color='primary'
|
||||||
onClick={handleAdd}
|
onClick={handleAdd}
|
||||||
disabled={!inputValues.trim()}
|
disabled={!inputValues.trim()}
|
||||||
>
|
>
|
||||||
Add
|
Add
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonContainer>
|
</InputRow>
|
||||||
</div>
|
</div>
|
||||||
</StyledPopover>
|
</StyledPopover>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user