A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
feat: add preview to icon picker (#914)
Meier Lukasca1ecdf84811
diff --git a/apps/nextjs/src/components/icons/picker/icon-picker.tsx b/apps/nextjs/src/components/icons/picker/icon-picker.tsxindex ae11cd00a..51143cd01 100644--- a/apps/nextjs/src/components/icons/picker/icon-picker.tsx+++ b/apps/nextjs/src/components/icons/picker/icon-picker.tsx@@ -16,6 +16,7 @@ interface IconPickerProps {export const IconPicker = ({ initialValue, onChange, error, onFocus, onBlur }: IconPickerProps) => {const [value, setValue] = useState<string>(initialValue ?? "");const [search, setSearch] = useState(initialValue ?? "");+ const [previewUrl, setPreviewUrl] = useState<string | null>(initialValue ?? null);const t = useScopedI18n("common");@@ -52,6 +53,7 @@ export const IconPicker = ({ initialValue, onChange, error, onFocus, onBlur }: I<ComboboxonOptionSubmit={(value) => {setValue(value);+ setPreviewUrl(value);setSearch(value);onChange(value);combobox.closeDropdown();@@ -62,12 +64,15 @@ export const IconPicker = ({ initialValue, onChange, error, onFocus, onBlur }: I<Combobox.Target><InputBaserightSection={<Combobox.Chevron />}+ // eslint-disable-next-line @next/next/no-img-element+ leftSection={previewUrl ? <img src={previewUrl} alt="" style={{ width: 20, height: 20 }} /> : null}value={search}onChange={(event) => {combobox.openDropdown();combobox.updateSelectedOptionIndex();setSearch(event.currentTarget.value);setValue(event.currentTarget.value);+ setPreviewUrl(null);onChange(event.currentTarget.value);}}onClick={() => combobox.openDropdown()}@@ -78,6 +83,7 @@ export const IconPicker = ({ initialValue, onChange, error, onFocus, onBlur }: IonBlur={(event) => {onBlur?.(event);combobox.closeDropdown();+ setPreviewUrl(value);setSearch(value || "");}}rightSectionPointerEvents="none"