mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
35 lines
1010 B
TypeScript
35 lines
1010 B
TypeScript
|
import { useStyles } from 'component/context/ContectFormChip/ContextFormChip.styles';
|
||
|
import { Cancel } from '@material-ui/icons';
|
||
|
import ConditionallyRender from 'component/common/ConditionallyRender';
|
||
|
|
||
|
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>
|
||
|
);
|
||
|
};
|