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, AccordionContent,
AccordionToggle, AccordionToggle,
Box, Box,
Button,
Flex, Flex,
Grid, Grid,
GridItem, GridItem,
@ -26,7 +25,7 @@ import {
NotAllowedInput, NotAllowedInput,
useTracking, useTracking,
} from '@strapi/helper-plugin'; } from '@strapi/helper-plugin';
import { Drag, More } from '@strapi/icons'; import { Duplicate, Drag, More } from '@strapi/icons';
import { useField } from 'formik'; import { useField } from 'formik';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { getEmptyImage } from 'react-dnd-html5-backend'; 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)` const DeleteMenuItem = styled(MenuItem)`
color: ${({ theme }) => theme.colors.danger600}; color: ${({ theme }) => theme.colors.danger600};
`; `;
@ -482,18 +475,17 @@ export function Stage({
</MultiSelect> </MultiSelect>
</PermissionWrapper> </PermissionWrapper>
<ApplyToAllStages <IconButton
disabled={!canUpdate} disabled={!canUpdate}
size="L" icon={<Duplicate />}
type="button" label={formatMessage({
variant="secondary"
onClick={() => handleApplyPermissionsToAllStages(permissionsField.value)}
>
{formatMessage({
id: 'Settings.review-workflows.stage.permissions.apply.label', id: 'Settings.review-workflows.stage.permissions.apply.label',
defaultMessage: 'Apply to all stages', defaultMessage: 'Apply to all stages',
})} })}
</ApplyToAllStages> size="L"
variant="secondary"
onClick={() => handleApplyPermissionsToAllStages(permissionsField.value)}
/>
</Flex> </Flex>
)} )}
</GridItem> </GridItem>

View File

@ -272,7 +272,7 @@ describe('Admin | Settings | Review Workflow | Stage', () => {
'data-disabled' '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 () => { it('should render a list of all available roles (except super admins)', async () => {