2016-08-24 15:09:42 +02:00
|
|
|
/**
|
2017-03-18 17:34:00 +01:00
|
|
|
*
|
|
|
|
* LeftMenuLink
|
|
|
|
*
|
|
|
|
*/
|
2016-08-24 15:09:42 +02:00
|
|
|
|
2019-04-03 19:02:19 +02:00
|
|
|
import React from 'react';
|
2020-02-07 14:46:12 +01:00
|
|
|
import { upperFirst } from 'lodash';
|
2017-09-20 11:12:04 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2016-08-24 15:09:42 +02:00
|
|
|
|
2020-02-07 14:46:12 +01:00
|
|
|
import LeftMenuLinkContent from './LeftMenuLinkContent';
|
|
|
|
import Plugin from './Plugin';
|
2017-07-21 18:15:43 +02:00
|
|
|
|
2020-02-07 14:46:12 +01:00
|
|
|
const LeftMenuLink = ({
|
|
|
|
destination,
|
|
|
|
iconName,
|
|
|
|
label,
|
|
|
|
location,
|
|
|
|
source,
|
|
|
|
suffixUrlToReplaceForLeftMenuHighlight,
|
|
|
|
}) => {
|
2019-04-03 13:18:43 +02:00
|
|
|
const plugin =
|
2020-02-07 14:46:12 +01:00
|
|
|
source !== 'content-manager' && source !== '' ? (
|
|
|
|
<Plugin>
|
|
|
|
<span>{upperFirst(source.split('-').join(' '))}</span>
|
|
|
|
</Plugin>
|
2018-03-01 13:12:22 +01:00
|
|
|
) : (
|
2019-04-03 13:18:43 +02:00
|
|
|
''
|
2018-03-01 13:12:22 +01:00
|
|
|
);
|
|
|
|
|
2019-04-03 13:18:43 +02:00
|
|
|
return (
|
2020-02-07 14:46:12 +01:00
|
|
|
<>
|
|
|
|
<LeftMenuLinkContent
|
|
|
|
destination={destination}
|
|
|
|
iconName={iconName}
|
|
|
|
label={label}
|
|
|
|
location={location}
|
|
|
|
source={source}
|
|
|
|
suffixUrlToReplaceForLeftMenuHighlight={
|
|
|
|
suffixUrlToReplaceForLeftMenuHighlight
|
|
|
|
}
|
|
|
|
/>
|
2019-04-03 13:18:43 +02:00
|
|
|
{plugin}
|
2020-02-07 14:46:12 +01:00
|
|
|
</>
|
2019-04-03 13:18:43 +02:00
|
|
|
);
|
2020-02-07 14:46:12 +01:00
|
|
|
};
|
2016-08-24 15:09:42 +02:00
|
|
|
|
|
|
|
LeftMenuLink.propTypes = {
|
2017-09-20 11:12:04 +02:00
|
|
|
destination: PropTypes.string.isRequired,
|
2020-02-07 14:46:12 +01:00
|
|
|
iconName: PropTypes.string,
|
2017-09-20 11:12:04 +02:00
|
|
|
label: PropTypes.string.isRequired,
|
2019-04-03 13:18:43 +02:00
|
|
|
location: PropTypes.shape({
|
|
|
|
pathname: PropTypes.string,
|
|
|
|
}).isRequired,
|
2017-11-27 17:27:16 +01:00
|
|
|
source: PropTypes.string,
|
2019-08-26 16:36:58 +02:00
|
|
|
suffixUrlToReplaceForLeftMenuHighlight: PropTypes.string,
|
2017-11-27 17:27:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
LeftMenuLink.defaultProps = {
|
2020-02-07 14:46:12 +01:00
|
|
|
iconName: 'circle',
|
2017-11-27 17:27:16 +01:00
|
|
|
source: '',
|
2019-08-26 16:36:58 +02:00
|
|
|
suffixUrlToReplaceForLeftMenuHighlight: '',
|
2016-08-24 15:09:42 +02:00
|
|
|
};
|
|
|
|
|
2019-04-03 19:02:19 +02:00
|
|
|
export default LeftMenuLink;
|