HichamELBSI 4f5cd5a209 Reskin and refacto the left admin menu and add Single type section
Signed-off-by: HichamELBSI <elabbassih@gmail.com>
2020-02-11 17:13:31 +01:00

66 lines
1.3 KiB
JavaScript

/**
*
* LeftMenuLink
*
*/
import React from 'react';
import { upperFirst } from 'lodash';
import PropTypes from 'prop-types';
import LeftMenuLinkContent from './LeftMenuLinkContent';
import Plugin from './Plugin';
const LeftMenuLink = ({
destination,
iconName,
label,
location,
source,
suffixUrlToReplaceForLeftMenuHighlight,
}) => {
const plugin =
source !== 'content-manager' && source !== '' ? (
<Plugin>
<span>{upperFirst(source.split('-').join(' '))}</span>
</Plugin>
) : (
''
);
return (
<>
<LeftMenuLinkContent
destination={destination}
iconName={iconName}
label={label}
location={location}
source={source}
suffixUrlToReplaceForLeftMenuHighlight={
suffixUrlToReplaceForLeftMenuHighlight
}
/>
{plugin}
</>
);
};
LeftMenuLink.propTypes = {
destination: PropTypes.string.isRequired,
iconName: PropTypes.string,
label: PropTypes.string.isRequired,
location: PropTypes.shape({
pathname: PropTypes.string,
}).isRequired,
source: PropTypes.string,
suffixUrlToReplaceForLeftMenuHighlight: PropTypes.string,
};
LeftMenuLink.defaultProps = {
iconName: 'circle',
source: '',
suffixUrlToReplaceForLeftMenuHighlight: '',
};
export default LeftMenuLink;