Skip to content

Commit

Permalink
Add basic layout
Browse files Browse the repository at this point in the history
  • Loading branch information
schiehll committed May 19, 2019
1 parent 6cffa95 commit 5bab949
Show file tree
Hide file tree
Showing 16 changed files with 287 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6"
"react-dom": "^16.8.6",
"styled-components": "^4.2.0"
}
}
14 changes: 11 additions & 3 deletions src/Kerbs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import React from 'react'
import Doc from './doc.mdx'
import React, { Fragment } from 'react'
import GlobalStyles from 'components/global-styles'
import Layout from 'components/layout'

const Kerbs = () => <Doc />
const Kerbs = () => {
return (
<Fragment>
<GlobalStyles />
<Layout />
</Fragment>
)
}

export default Kerbs
3 changes: 3 additions & 0 deletions src/components/global-styles/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import GlobalStyle from './styles'

export default GlobalStyle
13 changes: 13 additions & 0 deletions src/components/global-styles/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createGlobalStyle } from 'styled-components'

const GlobalStyle = createGlobalStyle`
body {
margin: 0;
padding: 0;
background-color: #0B7BF8;
color: white;
font-family: Arial;
}
`

export default GlobalStyle
24 changes: 24 additions & 0 deletions src/components/layout/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'
import Logo from 'components/logo'
import Nav from 'components/nav'
import Search from 'components/search'
import Widgets from 'components/widgets'

import * as S from './styles'

const Layout = () => {
return (
<S.Wrapper>
<S.Sidebar>
<Logo>project name that's big</Logo>
<Nav />
</S.Sidebar>
<S.Content>
<Search />
<Widgets />
</S.Content>
</S.Wrapper>
)
}

export default Layout
16 changes: 16 additions & 0 deletions src/components/layout/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import styled from 'styled-components'

export const Wrapper = styled.div`
max-width: 1200px;
margin: 40px auto;
display: flex;
`

export const Sidebar = styled.div`
min-width: 140px;
margin-right: 40px;
`

export const Content = styled.div`
width: 100%;
`
8 changes: 8 additions & 0 deletions src/components/logo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import * as S from './styles'

const Logo = ({ children }) => {
return <S.Logo>{children}</S.Logo>
}

export default Logo
7 changes: 7 additions & 0 deletions src/components/logo/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from 'styled-components'

export const Logo = styled.div`
text-transform: uppercase;
font-weight: uppercase;
max-width: 100%;
`
30 changes: 30 additions & 0 deletions src/components/nav/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { useState } from 'react'
import * as S from './styles'

const items = [
{ id: 0, name: 'dashboard' },
{ id: 1, name: 'overview' },
{ id: 2, name: 'other' }
]

const Nav = () => {
const [activeItem, setActiveItem] = useState(items[0]?.id)

return (
<S.Nav>
{items.map(item => {
return (
<S.Item
key={item.id}
onClick={() => setActiveItem(item.id)}
active={item.id === activeItem}
>
{item.name}
</S.Item>
)
})}
</S.Nav>
)
}

export default Nav
37 changes: 37 additions & 0 deletions src/components/nav/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import styled, { css } from 'styled-components'

export const Nav = styled.ul`
list-style: none;
margin: 120px 0 0 0;
padding: 0;
`

export const Item = styled.li`
${({ active }) => css`
position: relative;
padding-left: 20px;
cursor: pointer;
height: 40px;
display: flex;
align-items: center;
opacity: 0.8;
text-transform: capitalize;
${active &&
`
opacity: 1;
&:before {
position: absolute;
content: '';
height: 40px;
width: 4px;
background-color: white;
left: 0;
}
`}
&:hover {
opacity: 1;
}
`}
`
8 changes: 8 additions & 0 deletions src/components/search/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import * as S from './styles'

const Search = () => {
return <S.Search type="search" placeholder="Search..." />
}

export default Search
7 changes: 7 additions & 0 deletions src/components/search/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from 'styled-components'

export const Search = styled.input`
border: none;
border-radius: 3px;
padding: 5px;
`
16 changes: 16 additions & 0 deletions src/components/widgets/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import Doc from 'doc.mdx'

import * as S from './styles'

const Widgets = () => {
return (
<S.Wrapper>
<S.Widget>
<Doc />
</S.Widget>
</S.Wrapper>
)
}

export default Widgets
13 changes: 13 additions & 0 deletions src/components/widgets/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from 'styled-components'

export const Wrapper = styled.main`
display flex;
margin-top: 40px;
`

export const Widget = styled.div`
background-color: white;
color: black;
padding: 10px;
border-radius: 3px;
`
2 changes: 1 addition & 1 deletion src/doc.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Overview

Some project overview
Some project overview 🚧
94 changes: 91 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,23 @@
lodash "^4.17.11"
to-fast-properties "^2.0.0"

"@emotion/is-prop-valid@^0.7.3":
version "0.7.3"
resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.7.3.tgz#a6bf4fa5387cbba59d44e698a4680f481a8da6cc"
integrity sha512-uxJqm/sqwXw3YPA5GXX365OBcJGFtxUVkB6WyezqFHlNe9jqUWH5ur2O2M8dGBz61kn1g3ZBlzUunFQXQIClhA==
dependencies:
"@emotion/memoize" "0.7.1"

"@emotion/[email protected]":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.1.tgz#e93c13942592cf5ef01aa8297444dc192beee52f"
integrity sha512-Qv4LTqO11jepd5Qmlp3M1YEjBumoTHcHFdgPTQ+sFlIL5myi/7xu/POwP7IRu6odBdmLXdtIs1D6TuW6kbwbbg==

"@emotion/unitless@^0.7.0":
version "0.7.3"
resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.3.tgz#6310a047f12d21a1036fb031317219892440416f"
integrity sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg==

"@mdx-js/loader@^1.0.19":
version "1.0.19"
resolved "https://registry.yarnpkg.com/@mdx-js/loader/-/loader-1.0.19.tgz#fbb7e74961801be6e1bf9fd839e0d30075d6e57a"
Expand Down Expand Up @@ -1201,6 +1218,21 @@ babel-loader@^8.0.6:
mkdirp "^0.5.1"
pify "^4.0.1"

"babel-plugin-styled-components@>= 1":
version "1.10.0"
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.0.tgz#ff1f42ad2cc78c21f26b62266b8f564dbc862939"
integrity sha512-sQVKG8irFXx14ZfaK1bBePirfkacl3j8nZwSZK+ZjsbnadRHKQTbhXbe/RB1vT6Vgkz45E+V95LBq4KqdhZUNw==
dependencies:
"@babel/helper-annotate-as-pure" "^7.0.0"
"@babel/helper-module-imports" "^7.0.0"
babel-plugin-syntax-jsx "^6.18.0"
lodash "^4.17.10"

babel-plugin-syntax-jsx@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=

bail@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.4.tgz#7181b66d508aa3055d3f6c13f0a0c720641dde9b"
Expand Down Expand Up @@ -1500,6 +1532,11 @@ camelcase@^5.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==

camelize@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=

caniuse-lite@^1.0.30000967:
version "1.0.30000969"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000969.tgz#7664f571f2072657bde70b00a1fc1ba41f1942a9"
Expand Down Expand Up @@ -1929,6 +1966,11 @@ crypto-browserify@^3.11.0:
randombytes "^2.0.0"
randomfill "^1.0.3"

css-color-keywords@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05"
integrity sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=

css-select@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858"
Expand All @@ -1939,6 +1981,15 @@ css-select@^1.1.0:
domutils "1.5.1"
nth-check "~1.0.1"

css-to-react-native@^2.2.2:
version "2.3.1"
resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-2.3.1.tgz#cf0f61e0514846e2d4dc188b0886e29d8bef64a2"
integrity sha512-yO+oEx1Lf+hDKasqQRVrAvzMCz825Huh1VMlEEDlRWyAhFb/FWb6I0KpEF1PkyKQ7NEdcx9d5M2ZEWgJAsgPvQ==
dependencies:
camelize "^1.0.0"
css-color-keywords "^1.0.0"
postcss-value-parser "^3.3.0"

[email protected]:
version "2.1.3"
resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2"
Expand Down Expand Up @@ -3927,7 +3978,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=

lodash@^4.17.11, lodash@^4.17.3, lodash@^4.17.5:
lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.3, lodash@^4.17.5:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
Expand Down Expand Up @@ -4089,6 +4140,11 @@ mem@^4.0.0:
mimic-fn "^2.0.0"
p-is-promise "^2.0.0"

memoize-one@^5.0.0:
version "5.0.4"
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.0.4.tgz#005928aced5c43d890a4dfab18ca908b0ec92cbc"
integrity sha512-P0z5IeAH6qHHGkJIXWw0xC2HNEgkx/9uWWBQw64FJj3/ol14VYdfVGWWr0fXfjhhv3TKVIqUq65os6O4GUNksA==

memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
Expand Down Expand Up @@ -4886,6 +4942,11 @@ posix-character-classes@^0.1.0:
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=

postcss-value-parser@^3.3.0:
version "3.3.1"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281"
integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==

prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
Expand Down Expand Up @@ -4929,7 +4990,7 @@ promise-inflight@^1.0.1:
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM=

prop-types@^15.6.2, prop-types@^15.7.2:
prop-types@^15.5.4, prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
Expand Down Expand Up @@ -5085,7 +5146,7 @@ react-dom@^16.8.6:
prop-types "^15.6.2"
scheduler "^0.13.6"

react-is@^16.8.1:
react-is@^16.6.0, react-is@^16.8.1:
version "16.8.6"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==
Expand Down Expand Up @@ -5918,6 +5979,33 @@ style-to-object@^0.2.1:
dependencies:
css "2.2.4"

styled-components@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-4.2.0.tgz#811fbbec4d64c7189f6c7482b9eb6fefa7fefef7"
integrity sha512-L/LzkL3ZbBhqIVHdR7DbYujy4tqvTNRfc+4JWDCYyhTatI+8CRRQUmdaR0+ARl03DWsfKLhjewll5uNLrqrl4A==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@emotion/is-prop-valid" "^0.7.3"
"@emotion/unitless" "^0.7.0"
babel-plugin-styled-components ">= 1"
css-to-react-native "^2.2.2"
memoize-one "^5.0.0"
prop-types "^15.5.4"
react-is "^16.6.0"
stylis "^3.5.0"
stylis-rule-sheet "^0.0.10"
supports-color "^5.5.0"

stylis-rule-sheet@^0.0.10:
version "0.0.10"
resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz#44e64a2b076643f4b52e5ff71efc04d8c3c4a430"
integrity sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw==

stylis@^3.5.0:
version "3.5.4"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.4.tgz#f665f25f5e299cf3d64654ab949a57c768b73fbe"
integrity sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q==

supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
Expand Down

0 comments on commit 5bab949

Please sign in to comment.