/** * * BoundRoute * */ import React from 'react'; import { get, includes, map, tail, toLower } from 'lodash'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import cn from 'classnames'; import styles from './styles.scss'; function BoundRoute({ route }) { const title = get(route, 'handler'); const formattedRoute = get(route, 'path') ? tail(get(route, 'path').split('/')) : []; const [ controller = '', action = '' ] = title ? title.split('.') : []; return (
  {controller} .{action}
{get(route, 'method')}
{map(formattedRoute, value => ( /{value} ))}
); } BoundRoute.defaultProps = { route: { handler: 'Nocontroller.error', method: 'GET', path: '/there-is-no-path', }, }; BoundRoute.propTypes = { route: PropTypes.object, }; export default BoundRoute;