2018-03-27 21:12:26 +03:00
|
|
|
import React, { Fragment } from 'react';
|
2018-01-30 18:04:03 +02:00
|
|
|
import { Grid, Row, Col } from 'joyent-react-styled-flexboxgrid';
|
2017-12-15 16:09:09 +02:00
|
|
|
import styled, { ThemeProvider } from 'styled-components';
|
|
|
|
import remcalc from 'remcalc';
|
2018-01-26 15:48:02 +02:00
|
|
|
|
|
|
|
import theme from '../theme';
|
2018-03-27 21:12:26 +03:00
|
|
|
import Logo from './logo';
|
|
|
|
import GHLogo from './ghlogo';
|
2017-12-15 16:09:09 +02:00
|
|
|
|
|
|
|
const Main = styled(Row)`
|
2018-03-27 21:12:26 +03:00
|
|
|
padding-top: ${remcalc(24)};
|
2017-12-15 16:09:09 +02:00
|
|
|
`;
|
|
|
|
|
2018-03-27 21:12:26 +03:00
|
|
|
const Sidebar = styled.div`
|
2017-12-15 16:09:09 +02:00
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
|
|
|
z-index: 9;
|
2018-03-27 21:12:26 +03:00
|
|
|
top: ${remcalc(0)};
|
|
|
|
margin-top: ${remcalc(-24)};
|
|
|
|
padding: ${remcalc(24)} 0;
|
|
|
|
margin-left: ${remcalc(10)};
|
|
|
|
max-height: 100vh;
|
|
|
|
overflow: auto;
|
|
|
|
background: white;
|
|
|
|
width: ${remcalc(234)};
|
|
|
|
border-right: ${remcalc(1)} solid ${props => props.theme.grey};
|
|
|
|
box-sizing: border-box;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Header = styled.header`
|
|
|
|
background: ${props => props.theme.greyDarker};
|
|
|
|
color: ${props => props.theme.white};
|
|
|
|
height: ${remcalc(48)};
|
|
|
|
padding: 0 ${remcalc(24)};
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const List = styled.ul`
|
|
|
|
list-style: none;
|
|
|
|
display: flex;
|
2017-12-15 16:09:09 +02:00
|
|
|
|
2018-03-27 21:12:26 +03:00
|
|
|
li {
|
|
|
|
a {
|
|
|
|
color: ${props => props.theme.white};
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(:last-child) {
|
|
|
|
border-right: ${remcalc(1)} solid ${props => props.theme.text};
|
|
|
|
padding-right: ${remcalc(24)};
|
|
|
|
margin-right: ${remcalc(24)};
|
|
|
|
}
|
|
|
|
}
|
2017-12-15 16:09:09 +02:00
|
|
|
`;
|
|
|
|
|
|
|
|
const fullTheme = {
|
|
|
|
...theme,
|
2018-01-29 20:09:18 +02:00
|
|
|
flexboxgrid: {
|
|
|
|
...theme.flexboxgrid,
|
|
|
|
breakpoints: {
|
|
|
|
xs: 0, // em
|
|
|
|
sm: 48, // em
|
|
|
|
md: 68, // em
|
|
|
|
lg: 85 // em
|
|
|
|
},
|
|
|
|
container: {
|
|
|
|
sm: 48, // rem
|
|
|
|
md: 68, // rem
|
|
|
|
lg: 85 // rem
|
|
|
|
}
|
2017-12-15 16:09:09 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const StyleGuideRenderer = ({
|
|
|
|
title,
|
|
|
|
homepageUrl,
|
|
|
|
children,
|
|
|
|
toc,
|
|
|
|
hasSidebar
|
|
|
|
}) => (
|
|
|
|
<ThemeProvider theme={fullTheme}>
|
2018-03-27 21:12:26 +03:00
|
|
|
<Fragment>
|
|
|
|
<Header>
|
|
|
|
<List>
|
|
|
|
<li>
|
|
|
|
<a href="/">Visuals</a>
|
|
|
|
</li>
|
|
|
|
<li>Copy Guide</li>
|
|
|
|
<li>
|
|
|
|
<a href="#!/Download">Downloads</a>
|
|
|
|
</li>
|
|
|
|
</List>
|
|
|
|
<Logo />
|
|
|
|
<a
|
|
|
|
href="https://github.com/yldio/joyent-portal/tree/master/packages/ui-toolkit"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
<GHLogo />
|
|
|
|
</a>
|
|
|
|
</Header>
|
|
|
|
<Grid style={{ marginLeft: 0 }}>
|
|
|
|
<Main>
|
|
|
|
{hasSidebar && (
|
|
|
|
<Col xs={3}>
|
|
|
|
<Sidebar>{toc}</Sidebar>
|
|
|
|
</Col>
|
|
|
|
)}
|
|
|
|
<Col xs={hasSidebar ? 9 : 12} lg={hasSidebar ? 8 : 12}>
|
|
|
|
{children}
|
2017-12-15 16:09:09 +02:00
|
|
|
</Col>
|
2018-03-27 21:12:26 +03:00
|
|
|
</Main>
|
|
|
|
</Grid>
|
|
|
|
</Fragment>
|
2017-12-15 16:09:09 +02:00
|
|
|
</ThemeProvider>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default StyleGuideRenderer;
|