2017-06-07 00:22:10 +03:00
|
|
|
import React from 'react';
|
|
|
|
import styled from 'styled-components';
|
2017-09-20 12:30:53 +03:00
|
|
|
import { Link } from 'react-router-dom';
|
2017-06-07 00:22:10 +03:00
|
|
|
import remcalc from 'remcalc';
|
|
|
|
|
|
|
|
import typography from '../typography';
|
|
|
|
import { H2 } from '../text/headings';
|
2017-10-23 17:09:49 +03:00
|
|
|
import Chevron from '../icons/chevron';
|
2017-06-07 00:22:10 +03:00
|
|
|
|
2017-09-20 12:30:53 +03:00
|
|
|
const LinkChild = styled(Link)`
|
|
|
|
text-decoration: none;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:visited {
|
|
|
|
color: inherit;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2017-06-07 00:22:10 +03:00
|
|
|
const Name = H2.extend`
|
|
|
|
${typography.normal};
|
2017-09-20 12:30:53 +03:00
|
|
|
|
2017-06-07 00:22:10 +03:00
|
|
|
color: ${props => props.theme.primary};
|
|
|
|
margin: ${remcalc(20)} 0 ${remcalc(18)} 0;
|
|
|
|
`;
|
|
|
|
|
2017-10-23 17:09:49 +03:00
|
|
|
const Arrow = styled(Chevron)`
|
|
|
|
margin: ${remcalc(7)} ${remcalc(10)} ${remcalc(3)} ${remcalc(10)};
|
2017-06-07 00:22:10 +03:00
|
|
|
`;
|
|
|
|
|
2017-09-20 12:30:53 +03:00
|
|
|
const Container = styled.div`
|
2017-10-23 17:09:49 +03:00
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
2017-09-20 12:30:53 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
export default ({ to, children, ...rest }) => {
|
|
|
|
const _child = to ? <LinkChild to={to}>{children}</LinkChild> : children;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Container>
|
|
|
|
<Name name="breadcrum-item" {...rest}>
|
|
|
|
{_child}
|
|
|
|
</Name>
|
|
|
|
<Arrow />
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
};
|