diff --git a/plugins/phosphor/src/App.css b/plugins/phosphor/src/App.css index a5fba417b..f27a87dbc 100644 --- a/plugins/phosphor/src/App.css +++ b/plugins/phosphor/src/App.css @@ -37,6 +37,11 @@ overflow-y: scroll; } +.search-input-container { + position: relative; + width: 100%; +} + .search-input { height: 30px; width: 100%; @@ -44,6 +49,7 @@ line-height: 24px; font-weight: 500 !important; font-family: "Inter", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + padding-left: 33px; } .search-input::placeholder { @@ -55,6 +61,17 @@ font-family: "Inter", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; } +.search-icon { + display: flex; + align-items: center; + justify-content: center; + position: absolute; + left: 11px; + top: 0; + bottom: 0; + color: var(--framer-color-text-tertiary); +} + .grid { width: 100%; display: grid; diff --git a/plugins/phosphor/src/App.tsx b/plugins/phosphor/src/App.tsx index d8e880ad1..300d7b65e 100644 --- a/plugins/phosphor/src/App.tsx +++ b/plugins/phosphor/src/App.tsx @@ -1,6 +1,7 @@ import { Draggable, framer, useIsAllowedTo } from "framer-plugin" import Fuse from "fuse.js" import { Suspense, useCallback, useDeferredValue, useMemo, useState } from "react" +import SearchIcon from "./SearchIcon" import "./App.css" import { icons as iconData } from "@phosphor-icons/core" @@ -66,6 +67,16 @@ const fuse = new Fuse(icons, { useExtendedSearch: true, }) +function formatIconName(name?: string): string { + if (!name) return "Unknown" + + return name + .split("-") + .filter(Boolean) + .map(part => part.charAt(0).toUpperCase() + part.slice(1)) + .join(" ") +} + function IconGrid(props: { searchQuery: string; weight: IconWeight }) { const { searchQuery, weight } = props @@ -90,6 +101,8 @@ function IconGrid(props: { searchQuery: string; weight: IconWeight }) { svg, name: "Icon", }) + + framer.notify(`Inserted ${formatIconName(entry.name)} icon`, { variant: "success" }) }, [weight] ) @@ -114,6 +127,17 @@ function IconGrid(props: { searchQuery: string; weight: IconWeight }) { name: "Icon", svg: renderToStaticMarkup(), })} + onDragComplete={result => { + if (result.status === "success") { + framer.notify(`Inserted ${formatIconName(entry.name)} icon`, { + variant: "success", + }) + } else { + framer.notify(`Failed to insert ${formatIconName(entry.name)} icon`, { + variant: "error", + }) + } + }} key={entry.name} > @@ -141,16 +165,21 @@ export function App() { return ( <>
- { - setSearchQuery(e.target.value) - }} - placeholder="Search…" - /> +
+ { + setSearchQuery(e.target.value) + }} + placeholder="Search…" + /> +
+ +
+