[WEB-5179] chore: icon utils code refactor #8458
This commit is contained in:
parent
ec215bb3b1
commit
630d2b9600
1 changed files with 2 additions and 2 deletions
|
|
@ -16,8 +16,8 @@ import {
|
||||||
FileCode,
|
FileCode,
|
||||||
Mail,
|
Mail,
|
||||||
Chrome,
|
Chrome,
|
||||||
|
Link2,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { LinkIcon } from "@plane/propel/icons";
|
|
||||||
|
|
||||||
type IconMatcher = {
|
type IconMatcher = {
|
||||||
pattern: RegExp;
|
pattern: RegExp;
|
||||||
|
|
@ -60,5 +60,5 @@ export const getIconForLink = (url: string) => {
|
||||||
const allMatchers = [...SOCIAL_MEDIA_MATCHERS, ...PRODUCTIVITY_MATCHERS, ...FILE_TYPE_MATCHERS, ...OTHER_MATCHERS];
|
const allMatchers = [...SOCIAL_MEDIA_MATCHERS, ...PRODUCTIVITY_MATCHERS, ...FILE_TYPE_MATCHERS, ...OTHER_MATCHERS];
|
||||||
|
|
||||||
const matchedIcon = allMatchers.find(({ pattern }) => pattern.test(lowerUrl));
|
const matchedIcon = allMatchers.find(({ pattern }) => pattern.test(lowerUrl));
|
||||||
return matchedIcon?.icon ?? LinkIcon;
|
return matchedIcon?.icon ?? Link2;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue