mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
feat(joyent-cp-frontend): integrate toolkit's SectionList
This commit is contained in:
parent
1fcd1b9eed
commit
8530b24691
@ -1,10 +1,3 @@
|
|||||||
import { Grid } from 'react-styled-flexboxgrid';
|
import { Grid } from 'react-styled-flexboxgrid';
|
||||||
import { breakpoints } from 'joyent-ui-toolkit';
|
|
||||||
|
|
||||||
export default Grid.extend`
|
export default Grid;
|
||||||
padding: 2rem;
|
|
||||||
|
|
||||||
${breakpoints.large`
|
|
||||||
padding: 0;
|
|
||||||
`}
|
|
||||||
`;
|
|
||||||
|
@ -19,6 +19,7 @@ const BreadcrumbLink = styled(Link)`
|
|||||||
|
|
||||||
const BreadcrumbContainer = styled.div`
|
const BreadcrumbContainer = styled.div`
|
||||||
border-bottom: solid ${remcalc(1)} ${props => props.theme.grey};
|
border-bottom: solid ${remcalc(1)} ${props => props.theme.grey};
|
||||||
|
margin-bottom: ${remcalc(19)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const getBreadcrumbItems = (...links) =>
|
const getBreadcrumbItems = (...links) =>
|
||||||
|
@ -2,45 +2,31 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { NavLink } from 'react-router-dom';
|
import forceArray from 'force-array';
|
||||||
import remcalc from 'remcalc';
|
|
||||||
|
|
||||||
import { breakpoints, Ul, Li } from 'joyent-ui-toolkit';
|
|
||||||
import { LayoutContainer } from '@components/layout';
|
import { LayoutContainer } from '@components/layout';
|
||||||
|
|
||||||
const StyledHorizontalList = Ul.extend`
|
import {
|
||||||
padding: 0;
|
SectionList,
|
||||||
`;
|
SectionListItem,
|
||||||
|
SectionListNavLink
|
||||||
|
} from 'joyent-ui-toolkit';
|
||||||
|
|
||||||
const StyledHorizontalListItem = Li.extend`
|
const getMenuItems = (...links) =>
|
||||||
${breakpoints.smallOnly`
|
forceArray(links).map(({ pathname, name }) =>
|
||||||
display: block;
|
<SectionListItem>
|
||||||
`}
|
<SectionListNavLink activeClassName="active" to={pathname}>
|
||||||
|
{name}
|
||||||
& + li {
|
</SectionListNavLink>
|
||||||
margin-left: ${remcalc(21)};
|
</SectionListItem>
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Menu = ({ links }) => {
|
|
||||||
const navLinks = links.map(link => {
|
|
||||||
return (
|
|
||||||
<StyledHorizontalListItem key={link.name}>
|
|
||||||
<NavLink activeClassName="active" to={link.pathname}>
|
|
||||||
{link.name}
|
|
||||||
</NavLink>
|
|
||||||
</StyledHorizontalListItem>
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
const Menu = ({ links = [] }) =>
|
||||||
<LayoutContainer>
|
<LayoutContainer>
|
||||||
<StyledHorizontalList>
|
<SectionList>
|
||||||
{navLinks}
|
{getMenuItems(...links)}
|
||||||
</StyledHorizontalList>
|
</SectionList>
|
||||||
</LayoutContainer>
|
</LayoutContainer>;
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Menu.propTypes = {
|
Menu.propTypes = {
|
||||||
links: PropTypes.arrayOf(
|
links: PropTypes.arrayOf(
|
||||||
|
Loading…
Reference in New Issue
Block a user