1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00
This commit is contained in:
andreas-unleash 2022-07-25 09:30:04 +03:00
parent 9a13c5c489
commit 70e8df83b5
2 changed files with 12 additions and 5 deletions

View File

@ -147,7 +147,7 @@ export const ConstraintAccordionEditHeader = ({
</p>
}
/>
<ConstraintAccordionHeaderActions onDelete={onDelete} />
<ConstraintAccordionHeaderActions onDelete={onDelete} disableEdit/>
</div>
);
};

View File

@ -2,15 +2,20 @@ import React from 'react';
import { IconButton, Tooltip } from '@mui/material';
import { Delete, Edit } from '@mui/icons-material';
import { useStyles } from '../ConstraintAccordion.styles';
import {ConditionallyRender} from "../../ConditionallyRender/ConditionallyRender";
interface ConstraintAccordionHeaderActionsProps {
onDelete?: () => void;
onEdit?: () => void;
disableEdit?: boolean;
disableDelete?: boolean
}
export const ConstraintAccordionHeaderActions = ({
onEdit,
onDelete,
disableDelete = false,
disableEdit = false
}: ConstraintAccordionHeaderActionsProps) => {
const { classes: styles } = useStyles();
const onEditClick =
@ -29,24 +34,26 @@ export const ConstraintAccordionHeaderActions = ({
return (
<div className={styles.headerActions}>
<ConditionallyRender condition={Boolean(onEditClick) && !disableEdit} show={
<Tooltip title="Edit constraint" arrow>
<IconButton
type="button"
onClick={onEditClick}
disabled={!Boolean(onEditClick)}
disabled={disableEdit}
>
<Edit />
</IconButton>
</Tooltip>
</Tooltip>} />
<ConditionallyRender condition={Boolean(onDeleteClick) && !disableDelete} show={
<Tooltip title="Delete constraint" arrow>
<IconButton
type="button"
onClick={onDeleteClick}
disabled={!Boolean(onDeleteClick)}
disabled={disableDelete}
>
<Delete />
</IconButton>
</Tooltip>
</Tooltip>} />
</div>
);
};