fix(review-workflows): make apply to all stages an iconbutton

This commit is contained in:
Gustav Hansen 2023-09-12 14:10:43 +02:00
parent b6e0798993
commit 1b6a57d366
2 changed files with 9 additions and 17 deletions

View File

@ -5,7 +5,6 @@ import {
AccordionContent,
AccordionToggle,
Box,
Button,
Flex,
Grid,
GridItem,
@ -26,7 +25,7 @@ import {
NotAllowedInput,
useTracking,
} from '@strapi/helper-plugin';
import { Drag, More } from '@strapi/icons';
import { Duplicate, Drag, More } from '@strapi/icons';
import { useField } from 'formik';
import PropTypes from 'prop-types';
import { getEmptyImage } from 'react-dnd-html5-backend';
@ -58,12 +57,6 @@ const PermissionWrapper = styled(Flex)`
}
`;
// Make sure the apply to all stages button doesn't collapse, when the Select
// contains more tags than it can fit into one line
const ApplyToAllStages = styled(Button)`
flex-shrink: 0;
`;
const DeleteMenuItem = styled(MenuItem)`
color: ${({ theme }) => theme.colors.danger600};
`;
@ -482,18 +475,17 @@ export function Stage({
</MultiSelect>
</PermissionWrapper>
<ApplyToAllStages
<IconButton
disabled={!canUpdate}
size="L"
type="button"
variant="secondary"
onClick={() => handleApplyPermissionsToAllStages(permissionsField.value)}
>
{formatMessage({
icon={<Duplicate />}
label={formatMessage({
id: 'Settings.review-workflows.stage.permissions.apply.label',
defaultMessage: 'Apply to all stages',
})}
</ApplyToAllStages>
size="L"
variant="secondary"
onClick={() => handleApplyPermissionsToAllStages(permissionsField.value)}
/>
</Flex>
)}
</GridItem>

View File

@ -272,7 +272,7 @@ describe('Admin | Settings | Review Workflow | Stage', () => {
'data-disabled'
);
expect(getByRole('button', { name: /apply to all stages/i })).toHaveAttribute('disabled');
expect(getByRole('button', { name: /apply to all stages/i })).toHaveAttribute('aria-disabled');
});
it('should render a list of all available roles (except super admins)', async () => {