diff --git a/app/about/page.tsx b/app/about/page.tsx new file mode 100644 index 0000000..cb0217c --- /dev/null +++ b/app/about/page.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +function About() { + return ( +
+ ); +} + +export default About; diff --git a/app/blog/page.tsx b/app/blog/page.tsx new file mode 100644 index 0000000..0f4291a --- /dev/null +++ b/app/blog/page.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +function Blog() { + return ( +
+ ); +} + +export default Blog; diff --git a/app/layout.tsx b/app/layout.tsx index ed86a9c..26a63ba 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,6 +3,7 @@ import { Inter } from 'next/font/google'; import './globals.css'; import React from 'react'; import { ThemeProvider as NextThemesProvider } from 'next-themes'; +import Navbar from '@/components/Navbar'; const inter = Inter({ subsets: [ 'latin' ] }); @@ -20,6 +21,7 @@ export default function RootLayout({ + { children } diff --git a/app/page.tsx b/app/page.tsx index b76ecfe..256f582 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,9 +1,7 @@ -import ThemeSwitcher from '@/components/ThemeSwitcher'; - export default function Home() { return (
- + {/**/ }
); } diff --git a/components/Navbar.tsx b/components/Navbar.tsx new file mode 100644 index 0000000..512c5ed --- /dev/null +++ b/components/Navbar.tsx @@ -0,0 +1,102 @@ +'use client'; + +import React, { useEffect, useState } from 'react'; +import { + Navbar as NextUINavbar, + NavbarBrand, + NavbarContent, + NavbarItem, + NavbarMenu, + NavbarMenuItem, + NavbarMenuToggle +} from '@nextui-org/react'; +import Link from 'next/link'; +import { usePathname } from 'next/navigation'; +import ThemeSwitcher from '@/components/ThemeSwitcher'; + + +const entries: { display_name: string; href: string; }[] = [ + { + display_name: 'Home', + href: '/' + }, + { + display_name: 'About', + href: '/about' + }, + { + display_name: 'Blog', + href: '/blog' + } +]; + +function Navbar() { + const [ scrolled, setScrolled ] = useState(false); + + useEffect(() => { + const handleScroll = () => { + const isScrolled = window.scrollY > 0; + setScrolled(isScrolled); + }; + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + + + return ( + <> + + + + + + + +

{ 'Lumither\'s site' }

+
+
+ + + +

{ 'Lumither\'s site' }

+
+ + { entries.map((item, index) => ( + // eslint-disable-next-line react-hooks/rules-of-hooks + + + { item.display_name } + + + )) } +
+ + + + + + + + + { entries.map((item, index) => ( + + + { item.display_name } + + + )) } + +
+ + ); +} + +export default Navbar; diff --git a/components/ThemeSwitcher.tsx b/components/ThemeSwitcher.tsx index 49f38d0..9db2f10 100644 --- a/components/ThemeSwitcher.tsx +++ b/components/ThemeSwitcher.tsx @@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react'; import { useTheme } from 'next-themes'; -import { Button } from '@nextui-org/react'; +import { Switch } from '@nextui-org/react'; +import { MdOutlineDarkMode, MdOutlineLightMode } from 'react-icons/md'; function ThemeSwitcher() { const [ mounted, setMounted ] = useState(false); @@ -18,12 +19,18 @@ function ThemeSwitcher() { return (
- - + } + endContent={ } + onValueChange={ (isSelected) => { + if (isSelected) { + setTheme('light'); + } else { + setTheme('dark'); + } + } } + >
); } diff --git a/package.json b/package.json index 8c6cdbb..3025b58 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "next": "14.2.2", "next-themes": "^0.3.0", "react": "^18", - "react-dom": "^18" + "react-dom": "^18", + "react-icons": "^5.1.0" }, "devDependencies": { "typescript": "^5",