Skip to content

Commit 0da66b6

Browse files
committed
add breakpoints to layout component
1 parent 19a8359 commit 0da66b6

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/components/Layout.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Navbar from './navbar/Navbar'
44
type LayoutProps = {
55
sidebarContentLeft?: ReactNode
66
children: ReactNode
7-
sidebarContentRight: ReactNode
7+
sidebarContentRight?: ReactNode
88
}
99

1010
export default function Layout({
@@ -15,14 +15,24 @@ export default function Layout({
1515
return (
1616
<div className="mx-auto bg-gray-200 dark:bg-dark-800 min-h-screen">
1717
<Navbar />
18-
<div className="grid grid-cols-9 gap-10 mt-10 px-60 pt-10">
18+
<div className="grid grid-cols-9 gap-10 mt-10 px-4 md:px-60 md:pt-10 ">
1919
{sidebarContentLeft && (
20-
<aside className="col-span-2">{sidebarContentLeft}</aside>
20+
<aside className="col-span-2 hidden md:block">
21+
{sidebarContentLeft}
22+
</aside>
2123
)}
22-
<main className={sidebarContentLeft ? 'col-span-5' : 'col-span-7'}>
24+
<main
25+
className={
26+
sidebarContentLeft ? 'col-span-9 md:col-span-5' : 'md:col-span-7'
27+
}
28+
>
2329
{children}
2430
</main>
25-
<aside className="col-span-2">{sidebarContentRight}</aside>
31+
{sidebarContentRight && (
32+
<aside className="col-span-2 hidden md:block">
33+
{sidebarContentRight}
34+
</aside>
35+
)}
2636
</div>
2737
<div></div>
2838
</div>

src/pages/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ const Home = ({
3636
}
3737

3838
return (
39-
<Layout
40-
sidebarContentLeft={leftSidebar}
41-
sidebarContentRight={<div>Promoted</div>}
42-
>
39+
<Layout sidebarContentLeft={leftSidebar}>
4340
<>
4441
<Feed root={query} />
4542
</>

0 commit comments

Comments
 (0)