Skip to content

Commit cce289e

Browse files
committed
Add boilerplate
1 parent 6ddbd59 commit cce289e

File tree

17 files changed

+1358
-228
lines changed

17 files changed

+1358
-228
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-json
8+
- id: check-added-large-files
9+
args: ["--maxkb=20000"]
10+
- id: check-yaml
11+
- id: double-quote-string-fixer
12+
13+
- repo: https://github.com/pre-commit/mirrors-prettier
14+
rev: v2.3.2
15+
hooks:
16+
- id: prettier

.prettierrc.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tabWidth = 2
2+
semi = false
3+
singleQuote = false

jsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "src"
4+
}
5+
}

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12+
"@chakra-ui/icons": "^1.0.15",
13+
"@chakra-ui/react": "^1.6.6",
14+
"@emotion/react": "^11.4.1",
15+
"@emotion/styled": "^11.3.0",
16+
"framer-motion": "^4.1.17",
1217
"next": "11.0.1",
1318
"react": "17.0.2",
14-
"react-dom": "17.0.2"
19+
"react-custom-scrollbars-2": "^4.4.0",
20+
"react-dom": "17.0.2",
21+
"react-scroll": "^1.8.3"
1522
},
1623
"devDependencies": {
1724
"eslint": "7.32.0",

pages/_app.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

pages/api/hello.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

pages/index.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/components/layouts/landing.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react"
2+
import { Flex } from "@chakra-ui/react"
3+
import Header from "sections/header"
4+
import Footer from "sections/footer"
5+
6+
export default function Landing(props) {
7+
return (
8+
<Flex direction="column">
9+
<Header />
10+
{props.children}
11+
<Footer />
12+
</Flex>
13+
)
14+
}

src/components/sections/header.js

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import React from "react"
2+
import {
3+
Box,
4+
Flex,
5+
Text,
6+
IconButton,
7+
Button,
8+
Stack,
9+
Collapse,
10+
Icon,
11+
Link,
12+
useColorModeValue,
13+
useBreakpointValue,
14+
useDisclosure,
15+
} from "@chakra-ui/react"
16+
17+
import { HamburgerIcon, CloseIcon } from "@chakra-ui/icons"
18+
19+
import menuItems from "../../utils"
20+
21+
const DesktopNav = () => {
22+
const linkColor = useColorModeValue("gray.600", "gray.200")
23+
const linkHoverColor = useColorModeValue("gray.800", "white")
24+
25+
return (
26+
<Stack direction="row" spacing={4}>
27+
{menuItems.map((navItem) => (
28+
<Box key={navItem.label}>
29+
<Link
30+
p={2}
31+
href={navItem.path ?? "#"}
32+
fontSize={"sm"}
33+
fontWeight={500}
34+
color={linkColor}
35+
_hover={{ textDecoration: "none", color: linkHoverColor }}
36+
>
37+
{navItem.label}
38+
</Link>
39+
</Box>
40+
))}
41+
</Stack>
42+
)
43+
}
44+
45+
const MobileNavItem = ({ label, path }) => {
46+
const { isOpen, onToggle } = useDisclosure()
47+
48+
return (
49+
<Stack spacing={4} onClick={onToggle}>
50+
<Flex
51+
py={2}
52+
as={Link}
53+
href={path ?? "#"}
54+
justify={"space-between"}
55+
align={"center"}
56+
_hover={{ textDecoration: "none" }}
57+
>
58+
<Text
59+
fontWeight={600}
60+
color={useColorModeValue("gray.600", "gray.200")}
61+
>
62+
{label}
63+
</Text>
64+
</Flex>
65+
66+
<Collapse
67+
isOpen={isOpen}
68+
animateOpacity
69+
style={{ marginTop: "0!important" }}
70+
></Collapse>
71+
</Stack>
72+
)
73+
}
74+
75+
const MobileNav = () => {
76+
return (
77+
<Stack
78+
bg={useColorModeValue("white", "gray.800")}
79+
p={4}
80+
display={{ md: "none" }}
81+
>
82+
{menuItems.map((navItem) => (
83+
<MobileNavItem key={navItem.label} {...navItem} />
84+
))}
85+
</Stack>
86+
)
87+
}
88+
89+
export default function Header({ className }) {
90+
const { isOpen, onToggle } = useDisclosure()
91+
92+
return (
93+
<Box>
94+
<Flex
95+
bg={useColorModeValue("white", "gray.800")}
96+
color={useColorModeValue("gray.600", "white")}
97+
minH={"60px"}
98+
py={{ base: 2 }}
99+
px={{ base: 4 }}
100+
borderBottom={1}
101+
borderStyle={"solid"}
102+
borderColor={useColorModeValue("gray.300", "gray.800")}
103+
align={"center"}
104+
>
105+
<Flex
106+
flex={{ base: 1, md: "auto" }}
107+
ml={{ base: -2 }}
108+
display={{ base: "flex", md: "none" }}
109+
>
110+
<IconButton
111+
onClick={onToggle}
112+
icon={
113+
isOpen ? <CloseIcon w={3} h={3} /> : <HamburgerIcon w={5} h={5} />
114+
}
115+
variant={"ghost"}
116+
aria-label={"Toggle Navigation"}
117+
/>
118+
</Flex>
119+
<Flex flex={{ base: 1 }} justify={{ base: "center", md: "start" }}>
120+
<Text
121+
textAlign={useBreakpointValue({ base: "center", md: "left" })}
122+
fontFamily={"heading"}
123+
color={useColorModeValue("gray.600", "white")}
124+
>
125+
Logo
126+
</Text>
127+
<Flex display={{ base: "none", md: "flex" }} ml={10}>
128+
<DesktopNav />
129+
</Flex>
130+
</Flex>
131+
</Flex>
132+
133+
<Collapse isOpen={isOpen} animateOpacity>
134+
<MobileNav />
135+
</Collapse>
136+
</Box>
137+
)
138+
}

src/components/ui/Logo.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react"
2+
import { Box, Text } from "@chakra-ui/react"
3+
4+
export default function Logo(props) {
5+
return (
6+
<Box {...props}>
7+
<Text fontSize="lg" fontWeight="bold">
8+
Logo
9+
</Text>
10+
</Box>
11+
)
12+
}

0 commit comments

Comments
 (0)