Skip to content

Commit de8b24b

Browse files
committed
SideBar
1 parent 01b6b04 commit de8b24b

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

components/SideBar.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from "react";
2+
import styled from "styled-components";
3+
4+
const Container = styled.div`
5+
margin: 2em 0;
6+
position: sticky;
7+
top: 1em;
8+
`;
9+
10+
const Item = styled.div`
11+
padding: 0.4em 0.8em;
12+
color: #111;
13+
border-bottom: 1px solid #0002;
14+
cursor: pointer;
15+
16+
&:hover {
17+
transition: 100ms;
18+
background: #0001;
19+
color: #0972d4;
20+
}
21+
`;
22+
23+
export function SideBar() {
24+
return (
25+
<Container>
26+
<Item>Item 1</Item>
27+
<Item>Item 2</Item>
28+
</Container>
29+
);
30+
}

pages/index.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
import Head from "next/head";
22
import React from "react";
3+
import styled from "styled-components";
34
import { CenterContainer } from "../components/CenterContainer";
45
import { NavBar } from "../components/NavBar";
6+
import { SideBar } from "../components/SideBar";
7+
8+
const Container = styled.div`
9+
display: grid;
10+
gap: 2em;
11+
grid-template-columns: 250px 1fr;
12+
`;
513

614
export default function Home() {
715
return (
816
<>
917
<NavBar />
1018
<CenterContainer style={{ margin: "2em 0" }}>
11-
<h2>Welcome to the docs!</h2>
12-
<p>Here you can find the docs</p>
19+
<Container>
20+
<SideBar />
21+
<div>
22+
<h2>Welcome to the docs!</h2>
23+
<p>Here you can find the docs</p>
24+
</div>
25+
</Container>
1326
</CenterContainer>
1427
</>
1528
);

0 commit comments

Comments
 (0)