2020-02-20 07:58:59 +01:00
|
|
|
/*
|
|
|
|
* NOTE:
|
|
|
|
* This component should be put in the strapi-helper-plugin
|
|
|
|
* at some point so the other packages can benefits from the updates
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-02-20 16:50:00 +01:00
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
2020-02-20 07:58:59 +01:00
|
|
|
import { HeaderModalTitle } from 'strapi-helper-plugin';
|
|
|
|
import ModalSection from '../ModalSection';
|
2020-02-20 16:50:00 +01:00
|
|
|
import Text from '../Text';
|
2020-02-20 07:58:59 +01:00
|
|
|
import Wrapper from './Wrapper';
|
|
|
|
|
|
|
|
const ModalHeader = ({ headers }) => {
|
|
|
|
return (
|
|
|
|
<Wrapper>
|
|
|
|
<ModalSection>
|
|
|
|
<HeaderModalTitle>
|
2020-02-20 16:50:00 +01:00
|
|
|
{headers.map(({ key, element }, index) => {
|
|
|
|
const shouldDisplayChevron = index < headers.length - 1;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment key={key}>
|
|
|
|
{element}
|
|
|
|
{shouldDisplayChevron && (
|
|
|
|
<Text as="span" fontSize="xs" color="#919bae">
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon="chevron-right"
|
|
|
|
style={{ margin: '0 10px' }}
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
)}
|
|
|
|
</Fragment>
|
|
|
|
);
|
2020-02-20 07:58:59 +01:00
|
|
|
})}
|
|
|
|
</HeaderModalTitle>
|
|
|
|
</ModalSection>
|
|
|
|
</Wrapper>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ModalHeader.defaultProps = {
|
|
|
|
headers: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
ModalHeader.propTypes = {
|
|
|
|
headers: PropTypes.array,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ModalHeader;
|