Skip to content

Commit 3f922fc

Browse files
committed
feat: Added check as commonicon
1 parent 1b61255 commit 3f922fc

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/components/generic/Icon.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ import { Custom } from "./Custom.ts";
44
import { PlainText } from "./PlainText.ts";
55

66
export const Symbol = (icon: string, ...classList: string[]): Component => {
7-
const webgenIcon: string = (globalThis as (typeof globalThis & { WEBGEN_ICON: string })).WEBGEN_ICON;
7+
const webgenIcon: string = (globalThis as (typeof globalThis & { WEBGEN_ICON: string; })).WEBGEN_ICON;
88
switch (webgenIcon) {
99
case "material":
10-
return Custom(custom("span", icon, "material-symbols-rounded", "webgen-icon", ...classList))
10+
return Custom(custom("span", icon, "material-symbols-rounded", "webgen-icon", ...classList));
1111
case "bootstrap":
12-
return Custom(custom("span", undefined, "bi", `bi-${icon}`, "webgen-icon", ...classList))
12+
return Custom(custom("span", undefined, "bi", `bi-${icon}`, "webgen-icon", ...classList));
1313
default:
14-
return PlainText("")
14+
return PlainText("");
1515
}
1616
};
1717

1818
export const Icon = (icon: string, ...classList: string[]): Component => {
19-
const webgenIcon: string = (globalThis as (typeof globalThis & { WEBGEN_ICON: string })).WEBGEN_ICON;
19+
const webgenIcon: string = (globalThis as (typeof globalThis & { WEBGEN_ICON: string; })).WEBGEN_ICON;
2020
switch (webgenIcon) {
2121
case "material":
22-
return Custom(custom("span", icon, "material-icons-round", "webgen-icon", ...classList))
22+
return Custom(custom("span", icon, "material-icons-round", "webgen-icon", ...classList));
2323
case "bootstrap":
24-
return Custom(custom("span", undefined, "bi", `bi-${icon}`, "webgen-icon", ...classList))
24+
return Custom(custom("span", undefined, "bi", `bi-${icon}`, "webgen-icon", ...classList));
2525
default:
26-
return PlainText("")
26+
return PlainText("");
2727
}
2828
};
2929

@@ -33,19 +33,21 @@ export const enum CommonIconType {
3333
Close,
3434
Download,
3535
Edit,
36-
Delete
36+
Delete,
37+
Check
3738
}
3839

3940
export const CommonIcon = (icon: CommonIconType): string => {
40-
const webgenIcon: string = (globalThis as (typeof globalThis & { WEBGEN_ICON: string })).WEBGEN_ICON;
41+
const webgenIcon: string = (globalThis as (typeof globalThis & { WEBGEN_ICON: string; })).WEBGEN_ICON;
4142
const mapping: { [ type in CommonIconType ]: [ material: string, bootstrap: string ] } = {
4243
[ CommonIconType.ArrowDown ]: [ "expand_more", "chevron-down" ],
4344
[ CommonIconType.Done ]: [ "done", "check2" ],
4445
[ CommonIconType.Close ]: [ "close", "x-lg" ],
4546
[ CommonIconType.Download ]: [ "get_app", "cloud-download" ],
4647
[ CommonIconType.Edit ]: [ "edit", "pencil" ],
47-
[ CommonIconType.Delete ]: [ "delete", "trash" ]
48+
[ CommonIconType.Delete ]: [ "delete", "trash" ],
49+
[ CommonIconType.Check ]: [ "check", "check2" ],
4850
};
4951

50-
return mapping![ icon ][ webgenIcon == "material" ? 0 : 1 ]
51-
}
52+
return mapping![ icon ][ webgenIcon == "material" ? 0 : 1 ];
53+
};

0 commit comments

Comments
 (0)