refactoring - created DumbTab for non routable tab

This commit is contained in:
Alex Windett 2017-03-01 12:07:52 +00:00
parent dcc410bc17
commit ea4b959c89

View File

@ -81,6 +81,20 @@ const ManageTab = styled(Tab)`
`} `}
`; `;
const DumbTab = ({
children
}) => (
<NavLi activeClassName='active' to='#'>{({
isActive
}) =>
<NavigationLinkContainer className={isActive ? 'active' : ''}>
<OrgName>
{children}
</OrgName>
</NavigationLinkContainer>
}</NavLi>
);
const OrgNavigation = ({ const OrgNavigation = ({
orgs = [] orgs = []
}) => { }) => {
@ -116,27 +130,11 @@ const OrgNavigation = ({
}); });
const manageTabs = () => ( const manageTabs = () => (
<NavLi activeClassName='active' to='#'>{({ <DumbTab>Manage Tabs ({orgs.length})</DumbTab>
isActive
}) =>
<NavigationLinkContainer className={isActive ? 'active' : ''}>
<OrgName>
Manage Tabs ({orgs.length})
</OrgName>
</NavigationLinkContainer>
}</NavLi>
); );
const addOrgTab = () => ( const addOrgTab = () => (
<NavLi activeClassName='active' to='#'>{({ <DumbTab>+ &nbsp; Add organisation</DumbTab>
isActive
}) =>
<NavigationLinkContainer className={isActive ? 'active' : ''}>
<OrgName>
+ &nbsp; Add organisation
</OrgName>
</NavigationLinkContainer>
}</NavLi>
); );
return ( return (
@ -157,6 +155,10 @@ OrgNavigation.propTypes = {
orgs: React.PropTypes.arrayOf(PropTypes.org) orgs: React.PropTypes.arrayOf(PropTypes.org)
}; };
DumbTab.propTypes = {
children: React.PropTypes.node
};
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
orgs: orgsSelector(state) orgs: orgsSelector(state)
}); });