1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/context/ContectFormChip/ContextFormChip.tsx

35 lines
1.0 KiB
TypeScript
Raw Normal View History

import { useStyles } from 'component/context/ContectFormChip/ContextFormChip.styles';
import { Cancel } from '@material-ui/icons';
import { ConditionallyRender } from 'component/common/ConditionallyRender/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>
);
};