diff --git a/web/src/components/add-to-search-bar-button.tsx b/web/src/components/add-to-search-bar-button.tsx new file mode 100644 index 00000000..e5cac0b8 --- /dev/null +++ b/web/src/components/add-to-search-bar-button.tsx @@ -0,0 +1,152 @@ +"use client" + +import { useState } from "react" +import { Check, Copy, Globe2, Search, Sparkles } from "lucide-react" +import { RainbowButton } from "@/registry/magicui/rainbow-button" +import { Button } from "@/components/ui/button" +import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog" +import { Input } from "@/components/ui/input" +import { Separator } from "@/components/ui/separator" +import { cn } from "@/lib/utils" + +const SEARCH_SCHEMA = "https://dashboardicons.com/icons?q=%s" + +const instructions: Array<{ browser: string; steps: string[] }> = [ + { + browser: "Chrome", + steps: [ + "Open Settings → Search engine → Manage search engines and site search", + "Click Add next to Site search", + "Name: Dashboard Icons · Shortcut: di (or anything you like)", + `URL with %s: ${SEARCH_SCHEMA}`, + "Save, then type your shortcut + Space/Tab in the address bar to search", + ], + }, + { + browser: "Firefox", + steps: [ + "Open Settings → Search", + "Scroll to Search Shortcuts and click Add", + "Name: Dashboard Icons · Keyword: di", + `Search URL: ${SEARCH_SCHEMA}`, + "Use the keyword + Space, then type your query", + ], + }, + { + browser: "Edge", + steps: [ + "Open Settings → Privacy, search, and services", + "Under Address bar and search, click Manage search engines", + "Select Add search engine", + "Name: Dashboard Icons · Shortcut: di · URL: above schema", + "Choose the new entry and Set as default or use via shortcut", + ], + }, + { + browser: "Safari", + steps: [ + "Open Settings → Search and enable “Quick Website Search”", + "Visit dashboardicons.com and run any search once", + "Soon Safari will suggest “dashboardicons” as a quick search option", + "Type dashboardicons + Space in the Smart Search field to search directly", + "If not suggested, add a Shortcut via Settings → Search → Manage Websites", + ], + }, +] + +export function AddToSearchBarButton({ + size = "default", + className, +}: { + size?: "sm" | "default" | "lg" + className?: string +}) { + const [copied, setCopied] = useState(false) + + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(SEARCH_SCHEMA) + setCopied(true) + setTimeout(() => setCopied(false), 1500) + } catch { + setCopied(false) + } + } + + return ( + + + + + Add to browser search + Add to search + + + + + + + + + Add dashboardicons to your browser search bar + + + Drop this search URL into your browser's custom search engines so you can type once and jump straight to the right icon. + + + +
+

Search URL (schema)

+
+ + +
+
+ + + +
+ {instructions.map((entry) => ( +
+
+

{entry.browser}

+ 1 minute setup +
+
    + {entry.steps.map((step, idx) => ( +
  1. + {idx + 1}. + {step} +
  2. + ))} +
+
+ ))} +
+
+
+ ) +} diff --git a/web/src/components/hero.tsx b/web/src/components/hero.tsx index 3867725a..ab006604 100644 --- a/web/src/components/hero.tsx +++ b/web/src/components/hero.tsx @@ -25,6 +25,7 @@ import { Button } from "@/components/ui/button" import { Card } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { cn } from "@/lib/utils" +import { AddToSearchBarButton } from "./add-to-search-bar-button" import { AuroraText } from "./magicui/aurora-text" import { InteractiveHoverButton } from "./magicui/interactive-hover-button" import { NumberTicker } from "./magicui/number-ticker" @@ -233,6 +234,9 @@ export function HeroSection({ totalIcons, stars }: { totalIcons: number; stars: +
+ +
diff --git a/web/src/components/icon-search.tsx b/web/src/components/icon-search.tsx index 59221315..2f22e7f5 100644 --- a/web/src/components/icon-search.tsx +++ b/web/src/components/icon-search.tsx @@ -5,9 +5,9 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation" import { useTheme } from "next-themes" import posthog from "posthog-js" import { useCallback, useEffect, useMemo, useRef, useState } from "react" -import { toast } from "sonner" import { VirtualizedIconsGrid } from "@/components/icon-grid" import { IconSubmissionContent } from "@/components/icon-submission-form" +import { AddToSearchBarButton } from "@/components/add-to-search-bar-button" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { @@ -325,6 +325,8 @@ export function IconSearch({ icons }: IconSearchProps) { + + {/* Clear all button */} {(searchQuery || selectedCategories.length > 0 || sortOption !== "relevance") && (