mirror of
https://github.com/strapi/strapi.git
synced 2025-08-11 18:27:22 +00:00
66 lines
1.3 KiB
JavaScript
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;
|