diff --git a/components/IconGrid.tsx b/components/IconGrid.tsx
new file mode 100644
index 0000000..edb2362
--- /dev/null
+++ b/components/IconGrid.tsx
@@ -0,0 +1,45 @@
+import { icons } from "@/lib/client/icons";
+import Fuse from "fuse.js";
+import { useMemo } from "react";
+
+const fuse = new Fuse(icons, {
+ keys: [{ name: "name", weight: 4 }, "tags", "categories"],
+ threshold: 0.2,
+ useExtendedSearch: true,
+});
+
+type Props = {
+ query: string;
+ color: string;
+ weight: "light" | "regular" | "bold" | "fill" | "duotone" | "thin";
+ iconName?: string;
+ setIconName: Function;
+};
+
+const IconGrid = ({ query, color, weight, iconName, setIconName }: Props) => {
+ const filteredQueryResultsSelector = useMemo(() => {
+ if (!query) {
+ return icons;
+ }
+ return fuse.search(query).map((result) => result.item);
+ }, [query]);
+
+ return filteredQueryResultsSelector.map((icon) => {
+ const IconComponent = icon.Icon;
+ return (
+
setIconName(icon.pascal_name)}
+ className={`cursor-pointer btn p-1 box-border bg-base-100 border-none w-full ${
+ icon.pascal_name === iconName
+ ? "outline outline-1 outline-primary"
+ : ""
+ }`}
+ >
+
+
+ );
+ });
+};
+
+export default IconGrid;
diff --git a/components/IconPicker.tsx b/components/IconPicker.tsx
index 513da2c..a712262 100644
--- a/components/IconPicker.tsx
+++ b/components/IconPicker.tsx
@@ -1,12 +1,11 @@
-import { icons } from "@/lib/client/icons";
-import React, { useMemo, useState, lazy, Suspense } from "react";
-import Fuse from "fuse.js";
+import React, { useState } from "react";
import TextInput from "./TextInput";
import Popover from "./Popover";
import { HexColorPicker } from "react-colorful";
import { useTranslation } from "next-i18next";
import Icon from "./Icon";
import { IconWeight } from "@phosphor-icons/react";
+import IconGrid from "./IconGrid";
type Props = {
alignment?: "left" | "right";
@@ -31,23 +30,10 @@ const IconPicker = ({
className,
reset,
}: Props) => {
- const fuse = new Fuse(icons, {
- keys: [{ name: "name", weight: 4 }, "tags", "categories"],
- threshold: 0.2,
- useExtendedSearch: true,
- });
-
const { t } = useTranslation();
const [query, setQuery] = useState("");
const [iconPicker, setIconPicker] = useState(false);
- const filteredQueryResultsSelector = useMemo(() => {
- if (!query) {
- return icons;
- }
- return fuse.search(query).map((result) => result.item);
- }, [query]);
-
return (
setWeight(e.target.value)}
>
- Regular
- Thin
- Light
- Bold
- Fill
- Duotone
+ {t("regular")}
+ {t("thin")}
+ {t("light_icon")}
+ {t("bold")}
+ {t("fill")}
+ {t("duotone")}
setColor(e)} />
-
+
setQuery(e.target.value)}
/>
- {filteredQueryResultsSelector.map((icon) => {
- const IconComponent = icon.Icon;
- return (
-
setIconName(icon.pascal_name)}
- className={`cursor-pointer btn p-1 box-border bg-base-100 border-none aspect-square ${
- icon.pascal_name === iconName
- ? "outline outline-1 outline-primary"
- : ""
- }`}
- >
-
-
- );
- })}
+
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index c2e9a82..6165806 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -372,5 +372,12 @@
"demo_desc": "This is only a demo instance of Linkwarden and uploads are disabled.",
"demo_desc_2": "If you want to try out the full version, you can sign up for a free trial at:",
"demo_button": "Login as demo user",
- "notes": "Notes"
+ "notes": "Notes",
+ "regular": "Regular",
+ "thin": "Thin",
+ "bold": "Bold",
+ "fill": "Fill",
+ "duotone": "Duotone",
+ "light_icon": "Light",
+ "search": "Search"
}
\ No newline at end of file