From b2500e306008bd1e7d5e30f193b708f438112cb0 Mon Sep 17 00:00:00 2001 From: Ajay Ghanwat Date: Sun, 17 Aug 2025 11:31:18 +0530 Subject: [PATCH] Added DropDown and Updated Config with Theme and Color Switcher --- package-lock.json | 27 ++ package.json | 2 + src/components/ColorSwitcher.astro | 11 +- src/components/Dropdown.astro | 518 +++++++++++++++++++++++++++++ src/components/ThemeSwitcher.astro | 11 +- src/pages/dropdown.astro | 67 ++++ src/pages/index.astro | 3 + 7 files changed, 623 insertions(+), 16 deletions(-) create mode 100644 src/components/Dropdown.astro create mode 100644 src/pages/dropdown.astro diff --git a/package-lock.json b/package-lock.json index 0436bd8..c26a4d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,8 @@ "version": "0.0.2-canary.21", "license": "MIT", "dependencies": { + "@floating-ui/core": "^1.7.3", + "@floating-ui/dom": "^1.7.3", "@tailwindcss/cli": "^4.1.12", "@tailwindcss/vite": "^4.1.12", "astro-icon": "^1.1.5", @@ -657,6 +659,31 @@ "node": ">=18" } }, + "node_modules/@floating-ui/core": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.3.tgz", + "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.10" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.3.tgz", + "integrity": "sha512-uZA413QEpNuhtb3/iIKoYMSK07keHPYeXF02Zhd6e213j+d1NamLix/mCLxBUDW/Gx52sPH2m+chlUsyaBs/Ag==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.7.3", + "@floating-ui/utils": "^0.2.10" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.10.tgz", + "integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==", + "license": "MIT" + }, "node_modules/@iconify-json/lets-icons": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@iconify-json/lets-icons/-/lets-icons-1.2.1.tgz", diff --git a/package.json b/package.json index e5230ab..c29db3b 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,8 @@ "release": "npm publish --access public" }, "dependencies": { + "@floating-ui/core": "^1.7.3", + "@floating-ui/dom": "^1.7.3", "@tailwindcss/cli": "^4.1.12", "@tailwindcss/vite": "^4.1.12", "astro-icon": "^1.1.5", diff --git a/src/components/ColorSwitcher.astro b/src/components/ColorSwitcher.astro index 3296161..26d2199 100644 --- a/src/components/ColorSwitcher.astro +++ b/src/components/ColorSwitcher.astro @@ -37,13 +37,9 @@ const { const dot = compact ? "wr:h-3.5 wr:w-3.5" : "wr:h-4 wr:w-4"; const btn = - "wr:inline-flex wr:items-center wr:gap-2 wr:rounded-xl wr:border wr:border-border wr:bg-background/80 wr:backdrop-blur-sm " + - "wr:text-foreground wr:h-10 wr:px-3 wr:text-sm wr:shadow-sm wr:transition wr:duration-200 wr:ease-out " + - "wr:hover:bg-muted/70 wr:focus-visible:outline-none wr:focus-visible:ring-2 wr:focus-visible:ring-primary/40 wr:focus-visible:ring-offset-2"; + "wr:py-3 wr:px-4 wr:inline-flex wr:items-center wr:gap-x-2 wr:text-sm wr:font-medium wr:rounded-lg wr:border wr:border-gray-200 wr:bg-white wr:text-gray-800 wr:shadow-2xs wr:hover:bg-gray-50 wr:focus:outline-hidden wr:focus:bg-gray-50 wr:disabled:opacity-50 wr:disabled:pointer-events-none wr:dark:bg-neutral-800 wr:dark:border-neutral-700 wr:dark:text-white wr:dark:hover:bg-neutral-700 wr:dark:focus:bg-neutral-700"; const iconBtn = - "wr:inline-flex wr:items-center wr:justify-center wr:h-9 wr:w-9 wr:rounded-xl wr:border wr:border-border wr:bg-background/80 wr:backdrop-blur-sm " + - "wr:text-foreground wr:shadow-sm wr:transition wr:duration-200 wr:ease-out wr:hover:bg-muted/70 " + - "wr:focus-visible:outline-none wr:focus-visible:ring-2 wr:focus-visible:ring-primary/40 wr:focus-visible:ring-offset-2"; + "wr:py-3 wr:px-4 wr:inline-flex wr:items-center wr:gap-x-2 wr:text-sm wr:font-medium wr:rounded-lg wr:border wr:border-gray-200 wr:bg-white wr:text-gray-800 wr:shadow-2xs wr:hover:bg-gray-50 wr:focus:outline-hidden wr:focus:bg-gray-50 wr:disabled:opacity-50 wr:disabled:pointer-events-none wr:dark:bg-neutral-800 wr:dark:border-neutral-700 wr:dark:text-white wr:dark:hover:bg-neutral-700 wr:dark:focus:bg-neutral-700"; const item = "wr:flex wr:items-center wr:gap-3 wr:w-full wr:px-3 wr:py-2.5 wr:rounded-lg wr:text-sm wr:hover:bg-muted/70 wr:transition wr:duration-150"; --- @@ -108,8 +104,7 @@ const item = )}