fix: transform dash. -> dashdot for icon find

This commit is contained in:
MauriceNino
2022-06-27 21:30:08 +02:00
parent c0ecc3d4c6
commit eb0313f551

View File

@@ -1,7 +1,21 @@
import { import {
ActionIcon, Anchor, Button, Center, ActionIcon,
Group, Image, LoadingOverlay, Modal, MultiSelect, Anchor,
ScrollArea, Select, Switch, Tabs, Text, TextInput, Title, Tooltip Button,
Center,
Group,
Image,
LoadingOverlay,
Modal,
MultiSelect,
ScrollArea,
Select,
Switch,
Tabs,
Text,
TextInput,
Title,
Tooltip,
} from '@mantine/core'; } from '@mantine/core';
import { useForm } from '@mantine/form'; import { useForm } from '@mantine/form';
import { useDebouncedValue } from '@mantine/hooks'; import { useDebouncedValue } from '@mantine/hooks';
@@ -42,10 +56,13 @@ export function AddItemShelfButton(props: any) {
} }
function MatchIcon(name: string, form: any) { function MatchIcon(name: string, form: any) {
console.log(name, name.replace(/^dash\.$/, 'dashdot'));
fetch( fetch(
`https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/${name `https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/${name
.replace(/\s+/g, '-') .replace(/\s+/g, '-')
.toLowerCase()}.png` .toLowerCase()
.replace(/^dash\.$/, 'dashdot')}.png`
).then((res) => { ).then((res) => {
if (res.ok) { if (res.ok) {
form.setFieldValue('icon', res.url); form.setFieldValue('icon', res.url);