2022-04-19 15:20:01 +02:00
|
|
|
import { useStyles } from 'component/context/ContectFormChip/ContextFormChip.styles';
|
|
|
|
import { Cancel } from '@material-ui/icons';
|
2022-05-02 12:52:33 +02:00
|
|
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
2022-04-19 15:20:01 +02:00
|
|
|
|
|
|
|
interface IContextFormChipProps {
|
|
|
|
label: string;
|
|
|
|
description?: string;
|
|
|
|
onRemove: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ContextFormChip = ({
|
|
|
|
label,
|
|
|
|
description,
|
|
|
|
onRemove,
|
|
|
|
}: IContextFormChipProps) => {
|
|
|
|
const styles = useStyles();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li className={styles.container}>
|
|
|
|
<div>
|
|
|
|
<div className={styles.label}>{label}</div>
|
|
|
|
<ConditionallyRender
|
|
|
|
condition={Boolean(description)}
|
|
|
|
show={() => (
|
|
|
|
<div className={styles.description}>{description}</div>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<button onClick={onRemove} className={styles.button}>
|
|
|
|
<Cancel titleAccess="Remove" />
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
};
|