Skip to content

Commit 483eab3

Browse files
committed
Improve sidebar layout
1 parent 8418d22 commit 483eab3

File tree

7 files changed

+39
-8
lines changed

7 files changed

+39
-8
lines changed

src/Dashboard/Dashboard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type DashboardProps = {}
66
const content = faker.lorem.paragraphs(50)
77

88
const Dashboard: React.FC<DashboardProps> = () => {
9-
return <div className="p-10">{content}</div>
9+
return <div className="px-14 py-8">{content}</div>
1010
}
1111

1212
export default Dashboard

src/_common/TheFooter/TheFooter.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22

33
const TheFooter: React.FC = () => {
4-
return <div className="TheFooter px-4 py-2">The Footer</div>
4+
return <div className="TheFooter px-8 py-4">The Footer</div>
55
}
66

77
export default TheFooter

src/_common/TheHeader/TheHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const TheHeader: React.FC<TheHeaderProps> = ({ onSidebarToggleClick }) => {
1111
<div
1212
className="
1313
TheHeader
14-
absolute flex w-full h-full items-center px-4
14+
absolute flex w-full h-full items-center px-8
1515
bg-white
1616
"
1717
>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react'
2+
3+
const links = [{ name: 'Dashboard' }, { name: 'Administration' }]
4+
5+
const SidebarNav = () => {
6+
return (
7+
<div id="AppSidebarNav" className="px-4 py-4">
8+
{links.map((link) => (
9+
<a
10+
href="/core/dashboard"
11+
className="block px-4 py-3 pl-12 mb-2 hover:text-purple-500 rounded-lg hover:bg-purple-50 font-semibold"
12+
key={link.name}
13+
>
14+
{link.name}
15+
</a>
16+
))}
17+
</div>
18+
)
19+
}
20+
21+
export default SidebarNav
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './SidebarNav'

src/_common/TheSidebar/TheSidebar.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import React, { memo } from 'react'
22
import BaseLogo from '_common/BaseLogo'
3+
import SidebarNav from './SidebarNav'
34

45
type TheSidebarProps = {}
56

67
const TheSidebar: React.FC<TheSidebarProps> = () => {
78
return (
89
<div className="TheSidebar absolute h-full w-full flex flex-col">
9-
<div className="h-16 flex items-center top-0 px-4">
10+
<div className="h-20 flex items-center top-0 px-4">
1011
<BaseLogo size={30} className="ml-10 mr-4 text-purple-500" />{' '}
1112
ModularAdmin
1213
</div>
13-
<div id="AppSidebarNav" className="" style={{ height: 300 }}>
14-
Nav Menu
14+
<div className="SidebarNavContainer flex-1 overflow-y-auto ">
15+
<SidebarNav />
1516
</div>
17+
<div className="SidebarFooterContainer p-4">Sidebar Footer</div>
1618
</div>
1719
)
1820
}

src/_layouts/DashboardLayout/DashboardLayout.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,16 @@ const DashboardLayout: React.FC = ({ children }) => {
5252
</div>
5353
</div>
5454
{/* Content */}
55-
<div id="AppContentContainer" className="w-full min-h-screen flex-auto">
55+
<div
56+
id="AppContentContainer"
57+
className="w-full min-h-screen flex-auto"
58+
style={{ backgroundColor: 'rgb(114 142 156 / 5%)' }}
59+
>
5660
{/* Header */}
57-
<div id="AppHeaderContainer" className="w-full h-16 sticky top-0 self-start">
61+
<div
62+
id="AppHeaderContainer"
63+
className="w-full h-20 sticky top-0 self-start"
64+
>
5865
<TheHeader onSidebarToggleClick={handleSidebarToggleClick} />
5966
</div>
6067
{/* Page */}

0 commit comments

Comments
 (0)