66 lines
1.3 KiB
JavaScript
Raw Normal View History

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';
import { upperFirst } from 'lodash';
import PropTypes from 'prop-types';
2016-08-24 15:09:42 +02:00
import LeftMenuLinkContent from './LeftMenuLinkContent';
import Plugin from './Plugin';
2017-07-21 18:15:43 +02:00
const LeftMenuLink = ({
destination,
iconName,
label,
location,
source,
suffixUrlToReplaceForLeftMenuHighlight,
}) => {
2019-04-03 13:18:43 +02:00
const plugin =
source !== 'content-manager' && source !== '' ? (
<Plugin>
<span>{upperFirst(source.split('-').join(' '))}</span>
</Plugin>
) : (
2019-04-03 13:18:43 +02:00
''
);
2019-04-03 13:18:43 +02:00
return (
<>
<LeftMenuLinkContent
destination={destination}
iconName={iconName}
label={label}
location={location}
source={source}
suffixUrlToReplaceForLeftMenuHighlight={
suffixUrlToReplaceForLeftMenuHighlight
}
/>
2019-04-03 13:18:43 +02:00
{plugin}
</>
2019-04-03 13:18:43 +02:00
);
};
2016-08-24 15:09:42 +02:00
LeftMenuLink.propTypes = {
destination: PropTypes.string.isRequired,
iconName: PropTypes.string,
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,
suffixUrlToReplaceForLeftMenuHighlight: PropTypes.string,
2017-11-27 17:27:16 +01:00
};
LeftMenuLink.defaultProps = {
iconName: 'circle',
2017-11-27 17:27:16 +01:00
source: '',
suffixUrlToReplaceForLeftMenuHighlight: '',
2016-08-24 15:09:42 +02:00
};
2019-04-03 19:02:19 +02:00
export default LeftMenuLink;