From 1bd88532796f75f83af1bffbf9c5c7df03a9b749 Mon Sep 17 00:00:00 2001 From: Mahendra Kumawat <117855423+mk016@users.noreply.github.com> Date: Sun, 11 Aug 2024 11:00:59 +0000 Subject: [PATCH 1/3] update the page.jsx for light and dark mode --- app/page.tsx | 97 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 39 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index ab50ffa..94550a5 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,20 +1,27 @@ 'use client'; -import { ArrowRight, Github, Twitter } from 'lucide-react'; +import { ArrowRight, Github, Twitter, Sun, Moon } from 'lucide-react'; + import { BACKGROUND_OPTIONS } from './components/background'; import { Button } from '@/components/ui/button'; import Playground from './components/playground'; -import { useState } from 'react'; +import { useState, ReactNode } from 'react'; import { Toaster } from 'sonner'; +type Theme = 'light' | 'dark'; + export default function Home() { - const [preview, setPreview] = useState(null); - const [theme, setTheme] = useState<'light' | 'dark'>('light'); + const [preview, setPreview] = useState(null); + const [theme, setTheme] = useState('light'); const resetBg = () => { setPreview(null); setTheme('light'); }; + const toggleTheme = () => { + setTheme(prevTheme => (prevTheme === 'light' ? 'dark' : 'light')); + }; + return ( <> @@ -24,49 +31,63 @@ export default function Home() {
-
-
- -
+ + -

+

Collection of modern,{' '} - + background snippets

-

- Ready-to-use, simply copy and paste into your next project. All +

+ 50+ Ready-to-use, simply copy and paste into your next project. All snippets crafted with Tailwind CSS and{' '} Vanilla CSS for easy integration.

{' '} + Go to Github +
- {BACKGROUND_OPTIONS.map((background, index) => { - return ( - - {background.component} - - ); - })} + {BACKGROUND_OPTIONS.map((background, index) => ( + + {background.component} + + ))}
-
+
{`These backgrounds are made for a full page background. The preview can be different from the actual result. Click on preview to test it. And don't forget to tweak it to your needs.`} @@ -126,15 +145,15 @@ export default function Home() {