Fix PR feedback

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-10-16 13:26:30 +02:00
parent 8bc07d48e4
commit c652dfadfc

View File

@ -7,7 +7,7 @@ import {
// contexts // contexts
useGlobalContext, useGlobalContext,
} from 'strapi-helper-plugin'; } from 'strapi-helper-plugin';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage, useIntl } from 'react-intl';
import { useDrop } from 'react-dnd'; import { useDrop } from 'react-dnd';
import { DropdownItem } from 'reactstrap'; import { DropdownItem } from 'reactstrap';
import { Inputs as Input } from '@buffetjs/custom'; import { Inputs as Input } from '@buffetjs/custom';
@ -30,6 +30,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [isModalFormOpen, setIsModalFormOpen] = useState(false); const [isModalFormOpen, setIsModalFormOpen] = useState(false);
const [isDraggingSibling, setIsDraggingSibling] = useState(false); const [isDraggingSibling, setIsDraggingSibling] = useState(false);
const { formatMessage } = useIntl();
const { emitEvent } = useGlobalContext(); const { emitEvent } = useGlobalContext();
@ -158,14 +159,12 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
const renderForm = () => { const renderForm = () => {
const type = get(attributes, [labelToEdit, 'type'], 'text'); const type = get(attributes, [labelToEdit, 'type'], 'text');
const shouldDisplaySortToggle = !['media', 'relation'].includes(type); const shouldDisplaySortToggle = !['media', 'relation'].includes(type);
const label = formatMessage({ id: `${pluginId}.form.Input.label` });
const description = formatMessage({ id: `${pluginId}.form.Input.label.inputDescription` });
return ( return (
<> <>
<div className="col-6" style={{ marginBottom: 4 }}> <div className="col-6" style={{ marginBottom: 4 }}>
<FormattedMessage id={`${pluginId}.form.Input.label`}>
{label => (
<FormattedMessage id={`${pluginId}.form.Input.label.inputDescription`}>
{description => (
<Input <Input
description={description} description={description}
label={label} label={label}
@ -175,10 +174,6 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
value={get(labelForm, 'label', '')} value={get(labelForm, 'label', '')}
onChange={handleChangeEditLabel} onChange={handleChangeEditLabel}
/> />
)}
</FormattedMessage>
)}
</FormattedMessage>
</div> </div>
{shouldDisplaySortToggle && ( {shouldDisplaySortToggle && (
<div className="col-6" style={{ marginBottom: 4 }}> <div className="col-6" style={{ marginBottom: 4 }}>