mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Fix PR feedback
This commit is contained in:
parent
98560758e3
commit
15f3a83f34
@ -6,7 +6,7 @@ import ComponentInfosWrapper from './ComponentInfosWrapper';
|
||||
const ComponentInfos = ({ category, name }) => {
|
||||
return (
|
||||
<ComponentInfosWrapper>
|
||||
(<UpperFirst content={category} />) —
|
||||
(<UpperFirst content={category} /> —
|
||||
<UpperFirst content={name} />)
|
||||
</ComponentInfosWrapper>
|
||||
);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { AttributeIcon } from '@buffetjs/core';
|
||||
import UpperFirst from '../UpperFirst';
|
||||
import Icon from './Icon';
|
||||
import Item from './Item';
|
||||
import Menu from './Menu';
|
||||
import Toggle from './Toggle';
|
||||
@ -12,11 +12,7 @@ const DropdownInfos = ({ headers, shouldDisplaySecondHeader }) => {
|
||||
|
||||
const toggle = () => setDropdownOpen(prevState => !prevState);
|
||||
return (
|
||||
<Wrapper
|
||||
isOpen={dropdownOpen}
|
||||
toggle={toggle}
|
||||
style={{ margin: 'auto 0px auto 0' }}
|
||||
>
|
||||
<Wrapper isOpen={dropdownOpen} toggle={toggle} style={{ margin: 'auto 0' }}>
|
||||
<Toggle>...</Toggle>
|
||||
<Menu style={{ top: '8px' }}>
|
||||
{headers.map((header, index) => {
|
||||
@ -26,10 +22,7 @@ const DropdownInfos = ({ headers, shouldDisplaySecondHeader }) => {
|
||||
|
||||
return (
|
||||
<Item key={index}>
|
||||
<AttributeIcon
|
||||
type={header.icon.name}
|
||||
style={{ margin: 'auto 20px auto 0' }}
|
||||
/>
|
||||
<Icon type={header.icon.name} />
|
||||
<span>
|
||||
<UpperFirst content={header.label} />
|
||||
</span>
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import { AttributeIcon } from '@buffetjs/core';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Icon = ({ type }) => (
|
||||
<AttributeIcon type={type} style={{ margin: 'auto 20px auto 0' }} />
|
||||
);
|
||||
|
||||
Icon.propTypes = {
|
||||
type: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default Icon;
|
||||
@ -2,27 +2,24 @@ import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { HeaderModalTitle } from 'strapi-helper-plugin';
|
||||
import { get } from 'lodash';
|
||||
import { AttributeIcon } from '@buffetjs/core';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import ComponentIcon from './ComponentIcon';
|
||||
import ComponentInfos from './ComponentInfos';
|
||||
import Icon from './Icon';
|
||||
import IconWrapper from './IconWrapper';
|
||||
import UpperFirst from '../UpperFirst';
|
||||
import DropdownInfos from './DropdownInfos';
|
||||
|
||||
const ModalHeader = ({ headerId, headers }) => {
|
||||
const shouldDisplayDrodDrown = headers.length > 3;
|
||||
const shouldDisplayDrodDown = headers.length > 3;
|
||||
|
||||
return (
|
||||
<section>
|
||||
<HeaderModalTitle style={{ textTransform: 'none' }}>
|
||||
{headerId && (
|
||||
<>
|
||||
<AttributeIcon
|
||||
type={get(headers, [0, 'icon', 'name'], '')}
|
||||
style={{ margin: 'auto 20px auto 0' }}
|
||||
/>
|
||||
<Icon type={get(headers, [0, 'icon', 'name'], '')} />
|
||||
<FormattedMessage
|
||||
id={headerId}
|
||||
values={{ name: get(headers, [0, 'label'], '') }}
|
||||
@ -38,13 +35,10 @@ const ModalHeader = ({ headerId, headers }) => {
|
||||
<FontAwesomeIcon icon={iconType} />
|
||||
</ComponentIcon>
|
||||
) : (
|
||||
<AttributeIcon
|
||||
type={iconType}
|
||||
style={{ margin: 'auto 20px auto 0' }}
|
||||
/>
|
||||
<Icon type={iconType} />
|
||||
);
|
||||
|
||||
if (shouldDisplayDrodDrown && index === 1) {
|
||||
if (shouldDisplayDrodDown && index === 1) {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
<IconWrapper>
|
||||
@ -58,7 +52,7 @@ const ModalHeader = ({ headerId, headers }) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (shouldDisplayDrodDrown && index === 2 && headers.length > 4) {
|
||||
if (shouldDisplayDrodDown && index === 2 && headers.length > 4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -175,9 +175,7 @@ const reducer = (state, action) => {
|
||||
)
|
||||
.updateIn(['modifiedData', 'components'], old => {
|
||||
const componentsSchema = newComponents.reduce((acc, current) => {
|
||||
let newAcc = addComponentsToState(state, current, acc);
|
||||
|
||||
return newAcc;
|
||||
return addComponentsToState(state, current, acc);
|
||||
}, old);
|
||||
|
||||
return componentsSchema;
|
||||
|
||||
@ -34,7 +34,7 @@ describe('FormModal | utils | createHeadersArray', () => {
|
||||
expect(createHeadersArray(data)).toEqual([]);
|
||||
});
|
||||
|
||||
it('should return an array containing an header object', () => {
|
||||
it('should return an array containing a header object', () => {
|
||||
const data = {
|
||||
actionType: 'something',
|
||||
attributeName: null,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import createHeadersObjectFromArray from '../createHeadersObjectFromArray';
|
||||
|
||||
describe('FormModal | utils | createHeadersArray', () => {
|
||||
it('should return an headers object', () => {
|
||||
it('should return a header object', () => {
|
||||
const data = [
|
||||
{
|
||||
label: 'test',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user