CM: Move PublicationState and ReviewWorkflowsStage into cell content

This commit is contained in:
Gustav Hansen 2023-03-16 10:17:57 +01:00
parent 53b07d527d
commit 27753fc03b
7 changed files with 6 additions and 11 deletions

View File

@ -1,28 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import { Status, Typography } from '@strapi/design-system';
import { getTrad } from '../../../utils';
const StyledStatus = styled(Status)`
width: min-content;
`;
import { getTrad } from '../../../../utils';
export function PublicationState({ isPublished }) {
const { formatMessage } = useIntl();
const variant = isPublished ? 'success' : 'secondary';
return (
<StyledStatus showBullet={false} variant={variant} size="S">
<Status showBullet={false} variant={variant} size="S" width="min-content">
<Typography fontWeight="bold" textColor={`${variant}700`}>
{formatMessage({
id: getTrad(`containers.List.${isPublished ? 'published' : 'draft'}`),
defaultMessage: isPublished ? 'Published' : 'Draft',
})}
</Typography>
</StyledStatus>
</Status>
);
}

View File

@ -10,8 +10,8 @@ import { getTrad } from '../../utils';
import TableRows from './TableRows';
import ConfirmDialogDeleteAll from './ConfirmDialogDeleteAll';
import ConfirmDialogDelete from './ConfirmDialogDelete';
import { PublicationState } from './PublicationState/PublicationState';
import { ReviewWorkflowsStage } from './ReviewWorkflowsStage';
import { PublicationState } from './CellContent/PublicationState/PublicationState';
import { ReviewWorkflowsStage } from './CellContent/ReviewWorkflowsStage';
const DynamicTable = ({
canCreate,
@ -90,7 +90,7 @@ const DynamicTable = ({
sortable: false,
},
cellFormatter({ strapi_reviewWorkflows_stage }) {
return <ReviewWorkflowsStage {...strapi_reviewWorkflows_stage} />;
return <ReviewWorkflowsStage name={strapi_reviewWorkflows_stage.name} />;
},
});
}