Skip to content
Permalink
Browse files

feat(website): [DSYS-1046] website structure and navigation

* feat(website): main structure and side nav

* feat(website): nav toggle. start getting-started.

* fix(website): add site-wrapper flexbox fallback

* fix(website): adjust header styles, add constants

* fix(website): isOpen props for subnav, box tokens on sidebar

* fix(website): change constant to snake case
  • Loading branch information...
richbachman committed Jul 31, 2019
1 parent 2fcdb23 commit 306586e61265ed3717ec3f898eb25fb521d25c1e
@@ -14,6 +14,7 @@ const pasteGlobalStyles = css`
export const StyledBase = styled.div`
font-family: ${themeGet('fonts.fontFamilyText')};
line-height: 1.15;
color: ${themeGet('textColors.colorText')};
font-weight: ${themeGet('fontWeights.fontWeightNormal')};
*,
@@ -1,166 +1,24 @@
import * as React from 'react';
import {graphql, useStaticQuery, Link} from 'gatsby';
import {Global, css} from '@emotion/core';
import styled from '@emotion/styled';
import {themeGet} from 'styled-system';
import {Global} from '@emotion/core';
import {Theme} from '@twilio-paste/theme';
import {Sidebar} from '../sidebar';
import {Header} from '../header';
import {Navigation} from '../navigation';
import {globalStyles, SiteBody, SiteMain} from './styles';

interface SiteWrapperProps {
children: React.ReactNode;
}
interface SiteWrapperPageQuery {
allPasteComponent: {
edges: [
{
node: {
name: string;
};
}
];
};
allPasteUtility: {
edges: [
{
node: {
name: string;
};
}
];
};
}

const pageQuery = graphql`
{
allSitePage(filter: {path: {ne: "/dev-404-page/"}}) {
edges {
node {
path
componentChunkName
componentPath
id
component
internalComponentName
isCreatedByStatefulCreatePages
pluginCreatorId
}
}
}
allPasteComponent(sort: {order: ASC, fields: name}) {
edges {
node {
name
version
}
}
}
allPasteUtility(sort: {order: ASC, fields: name}) {
edges {
node {
version
name
}
}
}
}
`;

const globalStyles = css`
body {
margin: 0;
}
`;

const SiteBody = styled.div`
display: flex;
`;

const SiteHeader = styled.header`
background-color: ${themeGet('backgroundColors.colorBackground')};
${themeGet('borderTypes.Light')};
border-width: 0 1px 0 0;
display: flex;
flex-direction: column;
padding: ${themeGet('space.space40')};
position: fixed;
bottom: 0;
top: 0;
width: ${themeGet('maxWidths.size30')};
`;

const SiteMain = styled.main`
margin-left: ${themeGet('widths.size30')};
padding: ${themeGet('space.space80')};
`;

const SiteNav = styled.nav``;

const SiteNavList = styled.ul`
list-style: none;
padding: 0;
margin: 0;
`;

const SiteNavNestList = styled(SiteNavList)`
margin-left: ${themeGet('space.space30')};
`;

const SiteNavItem = styled.li``;

const SiteNavAnchor = styled(Link)`
color: ${themeGet('textColors.colorText')};
display: block;
width: 100%;
`;

const SiteWrapper: React.FC<SiteWrapperProps> = props => {
const data: SiteWrapperPageQuery = useStaticQuery(pageQuery);
console.log('SiteWrapper Query', data);
return (
<Theme.Provider>
<Theme.Provider theme="sendgrid">
<Global styles={globalStyles} />
<SiteBody>
<SiteHeader>
<Header siteTitle="DSYS Docs" />
<SiteNav>
<SiteNavList>
<SiteNavItem>
<SiteNavAnchor to="/getting-started">Getting Started</SiteNavAnchor>
</SiteNavItem>
<SiteNavItem>
<SiteNavAnchor to="/tokens">Tokens</SiteNavAnchor>
</SiteNavItem>
<SiteNavItem>
<SiteNavAnchor to="/components">Components</SiteNavAnchor>
<SiteNavNestList>
{data.allPasteComponent.edges.map(({node}) => {
return (
<SiteNavItem key={node.name}>
<SiteNavAnchor to={`/components/${node.name.replace('@twilio-paste/', '')}`}>
{node.name.replace('@twilio-paste/', '')}
</SiteNavAnchor>
</SiteNavItem>
);
})}
</SiteNavNestList>
</SiteNavItem>
<SiteNavItem>
<SiteNavAnchor to="/components">Utilities</SiteNavAnchor>
<SiteNavNestList>
{data.allPasteUtility.edges.map(({node}) => {
return (
<SiteNavItem key={node.name}>
<SiteNavAnchor to={`/components/${node.name.replace('@twilio-paste/', '')}`}>
{node.name.replace('@twilio-paste/', '')}
</SiteNavAnchor>
</SiteNavItem>
);
})}
</SiteNavNestList>
</SiteNavItem>
</SiteNavList>
</SiteNav>
</SiteHeader>
<Sidebar>
<Header siteTitle="Paste" siteSubTitle="Design System" siteVersion="v0.1" />
<Navigation />
</Sidebar>
<SiteMain>{props.children}</SiteMain>
</SiteBody>
</Theme.Provider>
@@ -0,0 +1,32 @@
import {css} from '@emotion/core';
import styled from '@emotion/styled';
import {themeGet} from 'styled-system';

export const globalStyles = css`
body {
margin: 0;
}
`;

export const SiteBody = styled.div`
display: flex;
min-height: 100vh;
min-width: 240px;
height: 100vh;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol';
@supports (display: grid) {
display: grid;
grid-template-columns: 240px 1fr;
}
`;

export const SiteMain = styled.main`
padding: ${themeGet('space.space110')} ${themeGet('space.space200')};
overflow: auto;
@supports not (display: grid) {
flex: 1;
}
`;
@@ -1,27 +1,26 @@
import * as React from 'react';
import {Link} from 'gatsby';
import styled from '@emotion/styled';
import {themeGet} from 'styled-system';
import {StyledHeader} from './styled-header';
import {Text} from '@twilio-paste/text';
import {StyledHeader, StyledH3, StyledSpan, StyledLink} from './styles';
import {TWILIO_RED} from '../../constants';
import TwilioIcon from '../svg/twilio-icon';

interface HeaderProps {
siteTitle?: string;
siteSubTitle?: string;
siteVersion?: string;
}

const StyledHeaderLink = styled(Link)`
color: ${themeGet('textColors.colorText')};
&:visited {
color: ${themeGet('textColors.colorText')};
}
`;

const Header: React.FC<HeaderProps> = props => {
return (
<StyledHeader>
<h1>
<StyledHeaderLink to="/">{props.siteTitle}</StyledHeaderLink>
</h1>
<TwilioIcon color={TWILIO_RED} size={30} />
<Text as="h2" fontSize="fontSize50" marginTop="space40" marginBottom="space20">
<StyledLink to="/">{props.siteTitle}</StyledLink>
</Text>
<StyledH3 as="h3" fontSize="fontSize10" textColor="colorTextPlaceholder" margin={0}>
<StyledSpan>{props.siteSubTitle}</StyledSpan>
<StyledSpan>{props.siteVersion}</StyledSpan>
</StyledH3>
</StyledHeader>
);
};

This file was deleted.

@@ -0,0 +1,33 @@
import {Link} from 'gatsby';
import styled from '@emotion/styled';
import {themeGet} from 'styled-system';
import {Text} from '@twilio-paste/text';

export const StyledHeader = styled.header`
padding: 0 ${themeGet('space.space40')} ${themeGet('space.space40')};
margin-bottom: ${themeGet('space.space40')};
border-bottom: ${themeGet('borderWidths.borderWidth20')} solid ${themeGet('colors.colorGray30')};
`;

export const StyledLink = styled(Link)`
text-decoration: none;
color: inherit;
&:visited {
color: inherit;
}
`;

export const StyledH3 = styled(Text)`
display: flex;
`;

export const StyledSpan = styled.span`
flex: 1;
&:nth-of-type(2) {
flex: 0;
justify-self: flex-end;
font-weight: ${themeGet('fontWeights.fontWeightNormal')};
}
`;

1 comment on commit 306586e

@now

This comment has been minimized.

Copy link

now bot commented on 306586e Jul 31, 2019

Please sign in to comment.
You can’t perform that action at this time.