From fc3cbe6bf74b0e9a712c32a664d3fd0717b41f3a Mon Sep 17 00:00:00 2001 From: Yogye Berry Date: Sun, 8 Feb 2026 18:44:26 +0530 Subject: [PATCH] added dark mode on landing page --- src/components/Navbar.jsx | 45 +++++++++++++++++----- src/index.css | 5 +++ src/pages/LandingPage.jsx | 78 +++++++++++++++++++++------------------ tailwind.config.js | 13 ++++--- 4 files changed, 90 insertions(+), 51 deletions(-) diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index 8ef775d07..f04589c40 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -4,20 +4,29 @@ import logo from "../assets/logo_light_160.png"; import { SideSheet } from "@douyinfe/semi-ui"; import { IconMenu } from "@douyinfe/semi-icons"; import { socials } from "../data/socials"; +import useSettings from "../hooks/useSettings"; export default function Navbar() { const [openMenu, setOpenMenu] = useState(false); + const { settings, setSettings } = useSettings(); + + const toggleTheme = () => { + setSettings({ + ...settings, + mode: settings.mode === "light" ? "dark" : "light", + }); + }; return ( <>
- logo + logo
document .getElementById("features") @@ -28,19 +37,19 @@ export default function Navbar() { Editor Templates Docs @@ -73,6 +82,13 @@ export default function Navbar() { > +
); diff --git a/src/index.css b/src/index.css index 44dabcd02..ac7b12ab7 100644 --- a/src/index.css +++ b/src/index.css @@ -162,6 +162,11 @@ background-size: 20px 20px; } +[theme-mode="dark"] .bg-dots { + background-color: transparent; + background-image: radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px); +} + .sliding-vertical span { animation: top-to-bottom 9s linear infinite 0s; -ms-animation: top-to-bottom 9s linear infinite 0s; diff --git a/src/pages/LandingPage.jsx b/src/pages/LandingPage.jsx index 4fe62f07c..5d01bc597 100644 --- a/src/pages/LandingPage.jsx +++ b/src/pages/LandingPage.jsx @@ -18,6 +18,7 @@ import axios from "axios"; import { languages } from "../i18n/i18n"; import { Tweet } from "react-tweet"; import { socials } from "../data/socials"; +import useSettings from "../hooks/useSettings"; function shortenNumber(number) { if (number < 1000) return number; @@ -28,6 +29,7 @@ function shortenNumber(number) { export default function LandingPage() { const [stats, setStats] = useState({ stars: 18000, forks: 1200 }); + const { settings } = useSettings(); useEffect(() => { const fetchStats = async () => { @@ -36,7 +38,6 @@ export default function LandingPage() { .then((res) => setStats(res.data)); }; - document.body.setAttribute("theme-mode", "light"); document.title = "drawDB | Online database diagram editor and SQL generator"; @@ -45,7 +46,7 @@ export default function LandingPage() { return (
-
+
@@ -53,12 +54,12 @@ export default function LandingPage() { {/* Hero section */} -
+
-
+

@@ -67,13 +68,13 @@ export default function LandingPage() {
Free and open source, simple, and intuitive database design editor, data-modeler, and SQL generator.{" "} - + No sign up - + Free of charge - + Quick and easy
@@ -81,7 +82,7 @@ export default function LandingPage() {
Try it for yourself @@ -103,10 +104,10 @@ export default function LandingPage() { {/* Learn more */}
-
+
{/* Supported by */}
-
+
Supported by
@@ -114,6 +115,7 @@ export default function LandingPage() { href="https://warp.dev/drawdb" target="_blank" rel="noreferrer" + className="inline-block bg-white rounded-xl p-8 hover:scale-105 transition-transform duration-300 shadow-md text-zinc-800" >
-
+
Build diagrams with a few clicks, see the full picture, export SQL scripts, customize your editor, and more. @@ -136,41 +138,45 @@ export default function LandingPage() {
-
+
{shortenNumber(stats.stars)}
-
+
GitHub stars
-
+
{shortenNumber(stats.forks)}
-
+
GitHub forks
-
+
{shortenNumber(languages.length)}
-
+
Languages
-
+
Design for your database
-
+
{dbs.map((s, i) => ( - + className="bg-white rounded-xl p-8 hover:scale-105 transition-transform duration-300 shadow-md flex items-center justify-center w-full h-full" + > + +
))}
@@ -183,27 +189,27 @@ export default function LandingPage() { >
{/* Features */} -
+
-
+
More than just an editor
-
+
What drawDB has to offer
{features.map((f, i) => (
-
+
{f.title}
{f.content} @@ -216,12 +222,12 @@ export default function LandingPage() {
{/* Tweets */} -
-
+
+
What the internet says about us
@@ -241,10 +247,10 @@ export default function LandingPage() { > -
+
Reach out to us
diff --git a/tailwind.config.js b/tailwind.config.js index 619a0f9f6..82cae1834 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -3,14 +3,15 @@ export default { content: [ "./src/**/*.{js,jsx,ts,tsx}", ], + darkMode: ['selector', '[theme-mode="dark"]'], theme: { screens: { - '3xl': {'max': '2047px'}, - '2xl': {'max': '1535px'}, - 'xl': {'min': '1024px'}, - 'lg': {'max': '1023px'}, - 'md': {'max': '820px'}, - 'sm': {'max': '639px'} + '3xl': { 'max': '2047px' }, + '2xl': { 'max': '1535px' }, + 'xl': { 'min': '1024px' }, + 'lg': { 'max': '1023px' }, + 'md': { 'max': '820px' }, + 'sm': { 'max': '639px' } }, extend: {} },