Skip to content

Commit

Permalink
fix: legal values styling in segments (#9044)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Dec 31, 2024
1 parent 71eb6b1 commit 18cd0e2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ export const useStyles = makeStyles()((theme) => ({
container: {
display: 'inline-block',
wordBreak: 'break-word',
padding: theme.spacing(0.5, 1),
background: theme.palette.background.paper,
border: `1px solid ${theme.palette.divider}`,
borderRadius: theme.shape.borderRadius,
'&:hover': {
border: `1px solid ${theme.palette.primary.main}`,
},
},
value: {
lineHeight: 1.33,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { Alert, Checkbox } from '@mui/material';
import { Alert, Checkbox, styled } from '@mui/material';
import { useThemeStyles } from 'themes/themeStyles';
import { ConstraintValueSearch } from 'component/common/ConstraintAccordion/ConstraintValueSearch/ConstraintValueSearch';
import { ConstraintFormHeader } from '../ConstraintFormHeader/ConstraintFormHeader';
Expand Down Expand Up @@ -49,6 +49,17 @@ export const getIllegalValues = (
return constraintValues.filter((value) => deletedValuesSet.has(value));
};

const StyledValuesContainer = styled('div')(({ theme }) => ({
display: 'flex',
flexWrap: 'wrap',
gap: theme.spacing(1),
padding: theme.spacing(2),
border: `1px solid ${theme.palette.divider}`,
borderRadius: theme.shape.borderRadiusMedium,
maxHeight: '378px',
overflow: 'auto',
}));

export const RestrictiveLegalValues = ({
data,
values,
Expand Down Expand Up @@ -134,23 +145,25 @@ export const RestrictiveLegalValues = ({
/>
}
/>
{filteredValues.map((match) => (
<LegalValueLabel
key={match.value}
legal={match}
control={
<Checkbox
checked={Boolean(valuesMap[match.value])}
onChange={() => onChange(match.value)}
name={match.value}
color='primary'
disabled={deletedLegalValues
.map(({ value }) => value)
.includes(match.value)}
/>
}
/>
))}
<StyledValuesContainer>
{filteredValues.map((match) => (
<LegalValueLabel
key={match.value}
legal={match}
control={
<Checkbox
checked={Boolean(valuesMap[match.value])}
onChange={() => onChange(match.value)}
name={match.value}
color='primary'
disabled={deletedLegalValues
.map(({ value }) => value)
.includes(match.value)}
/>
}
/>
))}
</StyledValuesContainer>

<ConditionallyRender
condition={Boolean(error)}
Expand Down

0 comments on commit 18cd0e2

Please sign in to comment.