parent
8d584459d0
commit
433d8db50a
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import paramCase from 'param-case';
|
import paramCase from 'param-case';
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
|
|
||||||
import { Breadcrumb } from 'joyent-ui-toolkit';
|
import { Breadcrumb, BreadcrumbItem } from 'joyent-ui-toolkit';
|
||||||
|
|
||||||
export default ({ match }) => {
|
export default ({ match }) => {
|
||||||
const instance = get(match, 'params.instance');
|
const instance = get(match, 'params.instance');
|
||||||
@ -12,14 +12,21 @@ export default ({ match }) => {
|
|||||||
name: '/',
|
name: '/',
|
||||||
pathname: '/instances'
|
pathname: '/instances'
|
||||||
}
|
}
|
||||||
].concat(
|
]
|
||||||
instance && [
|
.concat(
|
||||||
{
|
instance && [
|
||||||
name: paramCase(instance),
|
{
|
||||||
pathname: `/instances/${instance}`
|
name: paramCase(instance),
|
||||||
}
|
pathname: `/instances/${instance}`
|
||||||
]
|
}
|
||||||
);
|
]
|
||||||
|
)
|
||||||
|
.filter(Boolean)
|
||||||
|
.map(({ name, pathname }) => (
|
||||||
|
<BreadcrumbItem key={name} to={pathname}>
|
||||||
|
{name}
|
||||||
|
</BreadcrumbItem>
|
||||||
|
));
|
||||||
|
|
||||||
return <Breadcrumb links={links.filter(Boolean)} />;
|
return <Breadcrumb>{links}</Breadcrumb>;
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,7 @@ import PackagesHOC from '@containers/packages';
|
|||||||
import {
|
import {
|
||||||
Message,
|
Message,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
|
BreadcrumbItem,
|
||||||
Anchor,
|
Anchor,
|
||||||
Button
|
Button
|
||||||
} from 'joyent-ui-toolkit';
|
} from 'joyent-ui-toolkit';
|
||||||
@ -78,21 +79,19 @@ class Home extends Component {
|
|||||||
</Message>
|
</Message>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
|
const breadcrumbLinks = [
|
||||||
|
{ name: 'Instances', pathname: '/' },
|
||||||
|
{ name: 'Create Instance', pathname: '/' }
|
||||||
|
].map(({ name, pathname }) => (
|
||||||
|
<BreadcrumbItem key={name} to={pathname}>
|
||||||
|
{name}
|
||||||
|
</BreadcrumbItem>
|
||||||
|
));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Main>
|
<Main>
|
||||||
<SectionNav />
|
<SectionNav />
|
||||||
<Breadcrumb
|
<Breadcrumb>{breadcrumbLinks}</Breadcrumb>
|
||||||
links={[
|
|
||||||
{
|
|
||||||
name: 'Instances',
|
|
||||||
pathname: '/'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Create Instance',
|
|
||||||
pathname: '/'
|
|
||||||
}
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
<Row>{_msg}</Row>
|
<Row>{_msg}</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Filters
|
<Filters
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import forceArray from 'force-array';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import remcalc from 'remcalc';
|
|
||||||
|
|
||||||
import View from '../layout/view-container';
|
|
||||||
import Breadcrumb from './index';
|
|
||||||
import Item from './item';
|
|
||||||
|
|
||||||
const Border = styled.div`
|
|
||||||
border-bottom: solid ${remcalc(1)} ${props => props.theme.grey};
|
|
||||||
`;
|
|
||||||
|
|
||||||
const getBreadcrumbItems = links =>
|
|
||||||
forceArray(links).map(({ pathname, name }) => (
|
|
||||||
<Item key={name} to={pathname}>
|
|
||||||
{name}
|
|
||||||
</Item>
|
|
||||||
));
|
|
||||||
|
|
||||||
const Container = ({ links = [] }) => (
|
|
||||||
<Border>
|
|
||||||
<View>
|
|
||||||
<Breadcrumb>{getBreadcrumbItems(links)}</Breadcrumb>
|
|
||||||
</View>
|
|
||||||
</Border>
|
|
||||||
);
|
|
||||||
|
|
||||||
Container.propTypes = {
|
|
||||||
links: PropTypes.arrayOf(
|
|
||||||
PropTypes.shape({
|
|
||||||
name: PropTypes.string,
|
|
||||||
pathname: PropTypes.string
|
|
||||||
})
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Container;
|
|
@ -1,14 +1,26 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import forceArray from 'force-array';
|
||||||
|
import styled from 'styled-components';
|
||||||
import { Row, Col } from 'react-styled-flexboxgrid';
|
import { Row, Col } from 'react-styled-flexboxgrid';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import remcalc from 'remcalc';
|
||||||
|
|
||||||
|
import View from '../layout/view-container';
|
||||||
|
import Breadcrumb from './index';
|
||||||
|
import Item from './item';
|
||||||
|
|
||||||
|
const Border = styled.div`
|
||||||
|
border-bottom: solid ${remcalc(1)} ${props => props.theme.grey};
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
|
||||||
* @example ./usage.md
|
|
||||||
*/
|
|
||||||
export default ({ children, ...rest }) => (
|
export default ({ children, ...rest }) => (
|
||||||
<Row name="breadcrum" {...rest}>
|
<Border {...rest}>
|
||||||
<Col xs={12}>{children}</Col>
|
<View>
|
||||||
</Row>
|
<Row name="breadcrum">
|
||||||
|
<Col xs={12}>{children}</Col>
|
||||||
|
</Row>
|
||||||
|
</View>
|
||||||
|
</Border>
|
||||||
);
|
);
|
||||||
|
|
||||||
export { default as Item } from './item';
|
export { default as Item } from './item';
|
||||||
export { default as Container } from './container';
|
|
||||||
|
@ -23,11 +23,7 @@ export { default as StatusLoader } from './status-loader';
|
|||||||
export { default as Slider } from './slider';
|
export { default as Slider } from './slider';
|
||||||
export { MetricGraph } from './metrics';
|
export { MetricGraph } from './metrics';
|
||||||
|
|
||||||
export {
|
export { default as Breadcrumb, Item as BreadcrumbItem } from './breadcrumb';
|
||||||
default as BreadcrumbView,
|
|
||||||
Item as BreadcrumbItem,
|
|
||||||
Container as Breadcrumb
|
|
||||||
} from './breadcrumb';
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
default as Progressbar,
|
default as Progressbar,
|
||||||
|
Loading…
Reference in New Issue
Block a user