ui: wip on styling resources page

This commit is contained in:
Jean-Philippe Sirois
2019-07-30 06:45:15 -04:00
parent d5cd08918b
commit 96d9aec89a
6 changed files with 48 additions and 13 deletions
+4 -4
View File
@@ -10,7 +10,6 @@ import { useStaticQuery, graphql } from "gatsby"
import { GlobalStyles } from "../../globalStyles" import { GlobalStyles } from "../../globalStyles"
import { ResourcesSidebar } from "../ResourcesSidebar" import { ResourcesSidebar } from "../ResourcesSidebar"
import { Footer } from "../Footer"
import * as SC from "./styles" import * as SC from "./styles"
export function ResourcesLayout({ children }: PropsWithChildren<{}>) { export function ResourcesLayout({ children }: PropsWithChildren<{}>) {
@@ -30,11 +29,12 @@ export function ResourcesLayout({ children }: PropsWithChildren<{}>) {
<SC.Main> <SC.Main>
<ResourcesSidebar /> <ResourcesSidebar />
<SC.MainContent> <SC.MainContent>
<h1>{data.site.siteMetadata.title}</h1> <SC.Container>
{children} <h1>{data.site.siteMetadata.title}</h1>
{children}
</SC.Container>
</SC.MainContent> </SC.MainContent>
</SC.Main> </SC.Main>
<Footer />
</div> </div>
) )
} }
+7 -1
View File
@@ -2,12 +2,13 @@ import styled from "styled-components"
export const Main = styled.div` export const Main = styled.div`
display: flex; display: flex;
margin: 128px auto 64px !important;
width: 100%; width: 100%;
min-height: 100vh;
` `
export const MainContent = styled.main` export const MainContent = styled.main`
flex: 1 1 auto; flex: 1 1 auto;
margin-top: 128px;
& > :first-child { & > :first-child {
margin-top: 0; margin-top: 0;
@@ -17,3 +18,8 @@ export const MainContent = styled.main`
margin-bottom: 0; margin-bottom: 0;
} }
` `
export const Container = styled.div`
width: 650px;
margin: 0 auto;
`
+11 -7
View File
@@ -2,6 +2,7 @@ import React, { useState } from "react"
import Tree from "react-treeview" import Tree from "react-treeview"
import { useStaticQuery, graphql } from "gatsby" import { useStaticQuery, graphql } from "gatsby"
import useBuildTree from "./useBuildTree" import useBuildTree from "./useBuildTree"
import banner from "../../images/tph-banner.png"
import * as SC from "./styles" import * as SC from "./styles"
export interface IFile { export interface IFile {
@@ -76,12 +77,14 @@ function Folder({ item }: { item: IFolder }) {
} }
return ( return (
<Tree <SC.TreeWrapper>
collapsed={collapsed} <Tree
nodeLabel={<div onClick={toggleCollapse}>{item.title}</div>} collapsed={collapsed}
> nodeLabel={<div onClick={toggleCollapse}>{item.title}</div>}
{item.children.map(plantTree)} >
</Tree> {item.children.map(plantTree)}
</Tree>
</SC.TreeWrapper>
) )
} }
@@ -91,7 +94,8 @@ export function ResourcesSidebar() {
return ( return (
<SC.ResourcesSidebarWrapper> <SC.ResourcesSidebarWrapper>
{tree.map(node => plantTree(node))} <SC.Banner src={banner} />
<SC.Inner>{tree.map(node => plantTree(node))}</SC.Inner>
</SC.ResourcesSidebarWrapper> </SC.ResourcesSidebarWrapper>
) )
} }
+25 -1
View File
@@ -3,8 +3,32 @@ import { Link } from "gatsby"
export const ResourcesSidebarWrapper = styled.div` export const ResourcesSidebarWrapper = styled.div`
box-sizing: border-box; box-sizing: border-box;
padding: 0 16px;
flex: 0 0 300px; flex: 0 0 300px;
background: #f9f9f9;
`
export const Banner = styled.img`
display: block;
width: 100%;
`
export const TreeWrapper = styled.div`
width: 100%;
padding: 12px 0;
& + & {
border-top: 1px solid #dbdbdb;
}
`
export const Inner = styled.div`
padding-top: 30px;
padding-left: 20px;
/* TODO: change this.. */
& > ${TreeWrapper} > .tree-view > .tree-view_item > div {
font-weight: 700;
}
` `
export const PageLink = styled(Link)` export const PageLink = styled(Link)`
+1
View File
@@ -11,6 +11,7 @@ export const GlobalStyles = createGlobalStyle`
} }
body { body {
margin: 0;
font-size: ${BASE_FONT_SIZE}px; font-size: ${BASE_FONT_SIZE}px;
line-height: ${BASE_LINE_HEIGHT}px; line-height: ${BASE_LINE_HEIGHT}px;
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB