mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 23:30:05 +02:00
fix(cp-frontend): Pass full paths to menu items
This commit is contained in:
parent
1533bf5d6e
commit
fe760dcca6
@ -2,8 +2,19 @@ import React from 'react';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { Menu as MenuComponent } from '@components/navigation';
|
import { Menu as MenuComponent } from '@components/navigation';
|
||||||
|
|
||||||
const Menu = ({ sections }) =>
|
const Menu = ({match, sections}) => {
|
||||||
sections && sections.length ? <MenuComponent links={sections} /> : null;
|
if(!sections || !sections.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sectionsWithPathnames = sections.map(section => {
|
||||||
|
return {
|
||||||
|
name: section.name,
|
||||||
|
pathname: `${match.url}/${section.pathname}`
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return <MenuComponent links={sectionsWithPathnames} /> ;
|
||||||
|
}
|
||||||
|
|
||||||
const ConnectedMenu = connect(
|
const ConnectedMenu = connect(
|
||||||
(state, ownProps) => {
|
(state, ownProps) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user