2018-05-08 22:22:35 +03:00
|
|
|
import React from 'react';
|
|
|
|
import remcalc from 'remcalc';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
|
|
|
|
const BottomNav = styled.div`
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
margin: 36px 0;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Link = styled.a`
|
|
|
|
color: #3b46cc;
|
|
|
|
font-size: 15px;
|
|
|
|
line-height: 24px;
|
|
|
|
text-decoration: none;
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default props => {
|
|
|
|
const items = props.items.map(item => item.name);
|
|
|
|
const selectedIndex =
|
|
|
|
items.indexOf(props.link) > -1 ? items.indexOf(props.link) : 0;
|
|
|
|
|
|
|
|
if (!items.length) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<BottomNav>
|
|
|
|
<div>
|
|
|
|
{selectedIndex > 0 ? (
|
|
|
|
<Link href={`/#!/${items[selectedIndex - 1]}`}>
|
2018-05-09 15:36:05 +03:00
|
|
|
← {items[selectedIndex - 1]}
|
2018-05-08 22:22:35 +03:00
|
|
|
</Link>
|
|
|
|
) : null}
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
{selectedIndex < items.length ? (
|
|
|
|
<Link href={`/#!/${items[selectedIndex + 1]}`}>
|
2018-05-09 15:36:05 +03:00
|
|
|
{items[selectedIndex + 1]} →
|
2018-05-08 22:22:35 +03:00
|
|
|
</Link>
|
|
|
|
) : null}
|
|
|
|
</div>
|
|
|
|
</BottomNav>
|
|
|
|
);
|
|
|
|
};
|