Skip to content

Commit

Permalink
fix: delete variant button tooltip (#3014)
Browse files Browse the repository at this point in the history
Small fix on the tooltip for the "delete variant" button in the new
environment variants form.


![image](https://user-images.githubusercontent.com/14320932/215116642-0e78a2a7-71d6-4fa1-9138-6133d71ef091.png)
  • Loading branch information
nunogois committed Jan 27, 2023
1 parent 897e973 commit f8e3456
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
InputAdornment,
styled,
Switch,
Tooltip,
} from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { IPayload } from 'interfaces/featureToggle';
Expand All @@ -30,7 +31,7 @@ const StyledVariantForm = styled('div')(({ theme }) => ({
borderRadius: theme.shape.borderRadiusLarge,
}));

const StyledDeleteButton = styled(IconButton)(({ theme }) => ({
const StyledDeleteButtonTooltip = styled(Tooltip)(({ theme }) => ({
position: 'absolute',
top: theme.spacing(2),
right: theme.spacing(2),
Expand Down Expand Up @@ -293,12 +294,23 @@ export const VariantForm = ({

return (
<StyledVariantForm>
<StyledDeleteButton
onClick={() => removeVariant(variant.id)}
disabled={isProtectedVariant(variant)}
<StyledDeleteButtonTooltip
arrow
title={
isProtectedVariant(variant)
? 'You need to have at least one variable variant'
: 'Delete variant'
}
>
<Delete />
</StyledDeleteButton>
<div>
<IconButton
onClick={() => removeVariant(variant.id)}
disabled={isProtectedVariant(variant)}
>
<Delete />
</IconButton>
</div>
</StyledDeleteButtonTooltip>
<StyledTopRow>
<StyledNameContainer>
<StyledLabel>Variant name</StyledLabel>
Expand Down

0 comments on commit f8e3456

Please sign in to comment.