Skip to content

Commit 36967a7

Browse files
committed
๐Ÿ’„ Add Header2
1 parent c604ff4 commit 36967a7

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

โ€Žsrc/components/Header2.tsxโ€Ž

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
import { Link, NavLink } from 'react-router';
3+
4+
5+
export default function Header() {
6+
7+
const linkClassName = (isActive: boolean) => `
8+
h-[42px] items-center px-4 py-2 rounded-md text-black font-semibold
9+
${isActive ? 'bg-gray-200' : 'hover:bg-gray-200 transition-all'}
10+
`;
11+
12+
return (
13+
<header className="sticky top-0 z-[100] flex w-full justify-center bg-gray-50 border">
14+
<div className="flex w-full items-center justify-between px-6 py-4 sm:w-screen-sm md:w-screen-md lg:w-screen-lg xl:max-w-screen-xl">
15+
<Link to="/" className="text-xl font-bold font-title">
16+
๋ชจ์ด์ƒค
17+
</Link>
18+
<div className="items-center space-x-2">
19+
20+
<NavLink
21+
to="/login"
22+
className={({ isActive }) => linkClassName(isActive)}
23+
>
24+
๋กœ๊ทธ์ธ
25+
</NavLink>
26+
<NavLink
27+
to="/register"
28+
className={({ isActive }) => linkClassName(isActive)}
29+
>
30+
ํšŒ์›๊ฐ€์ž…
31+
</NavLink>
32+
33+
</div>
34+
</div>
35+
</header>
36+
);
37+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Outlet } from 'react-router';
2+
import { Toaster } from 'sonner';
3+
import Header2 from '@/components/Header2';
4+
5+
export default function RootLayout() {
6+
return (
7+
<div className="flex flex-col min-h-screen">
8+
<Header2 />
9+
<main
10+
className="flex w-full flex-1 flex-col bg-white px-3 xs:px-0"
11+
style={{ padding: '2rem' }}
12+
>
13+
<Outlet />
14+
</main>
15+
<Toaster position="bottom-center" richColors />
16+
</div>
17+
);
18+
}

โ€Žsrc/routes.tsโ€Ž

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,23 @@ import NewEvent from './routes/NewEvent';
1212
import RegisterChoice from './routes/RegisterChoice';
1313
import RegisterForm from './routes/RegisterForm';
1414
import SocialCallback from './routes/SocialCallback';
15+
import RootLayout2 from './layouts/RootLayout2';
1516

1617
export const router = createBrowserRouter([
1718
{
1819
path: '/',
19-
Component: RootLayout,
20+
Component: RootLayout2,
2021
children: [
2122
{ index: true, Component: Home },
2223
{ path: 'login', Component: Login },
2324
{ path: 'register', Component: RegisterChoice },
2425
{ path: 'register/email', Component: RegisterForm },
26+
],
27+
},
28+
{
29+
path: '/',
30+
Component: RootLayout,
31+
children: [
2532
{ path: 'new-event', Component: NewEvent },
2633
{ path: 'auth/callback/:provider', Component: SocialCallback },
2734
{ path: 'test-main', Component: Dashboard }, // ํ…Œ์ŠคํŠธ์šฉ ๋ฉ”์ธ ํŽ˜์ด์ง€ ๋ผ์šฐํŠธ

0 commit comments

Comments
ย (0)