Fix PR feedback

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2021-05-05 12:02:47 +02:00
parent 3a90e30271
commit 7bcdecd2cf
2 changed files with 14 additions and 14 deletions

View File

@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Header as Base } from '@buffetjs/custom';
import { Header as BaseHeader } from '@buffetjs/custom';
import { Button } from '@buffetjs/core';
import { CheckPermissions } from '@strapi/helper-plugin';
import openWithNewTab from '../../utils/openWithNewTab';
@ -37,7 +37,6 @@ const Header = ({ currentDocVersion, docPrefixURL }) => {
defaultMessage: 'Update',
}),
color: 'success',
// onClick: () => {},
type: 'submit',
key: 'button-submit',
Component: props => (
@ -49,7 +48,7 @@ const Header = ({ currentDocVersion, docPrefixURL }) => {
];
return (
<Base
<BaseHeader
actions={headerActions}
content={formatMessage({
id: getTrad('containers.HomePage.PluginHeader.description'),

View File

@ -11,6 +11,16 @@ const ButtonContainer = ({ currentDocVersion, isHeader, onClick, onClickDelete,
return <div />;
}
const handleClickGenerate = e => {
e.preventDefault();
onClick(version);
};
const handleDelete = e => {
e.preventDefault();
onClickDelete(version);
};
return (
<div>
<StyledButton
@ -26,22 +36,13 @@ const ButtonContainer = ({ currentDocVersion, isHeader, onClick, onClickDelete,
<StyledButton
// FIXME when new DS ready
type="generateDocumentation"
onClick={e => {
e.preventDefault();
onClick(version);
}}
onClick={handleClickGenerate}
>
<FormattedMessage id="documentation.components.Row.regenerate" />
</StyledButton>
</CheckPermissions>
<CheckPermissions permissions={pluginPermissions.update}>
<StyledButton
type={version === currentDocVersion ? '' : 'trash'}
onClick={e => {
e.preventDefault();
onClickDelete(version);
}}
/>
<StyledButton type={version === currentDocVersion ? '' : 'trash'} onClick={handleDelete} />
</CheckPermissions>
</div>
);