Skip to content

Commit 1f44353

Browse files
committed
Feat: Accept icon on TypeIcon
1 parent 214f508 commit 1f44353

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import {
2-
mdiFileCabinet, mdiFileDocumentOutline, mdiTextBoxOutline
2+
mdiFileCabinet,
3+
mdiFileDocumentOutline,
4+
mdiTextBoxOutline
35
} from "@mdi/js";
4-
import { Icon } from '@mdi/react';
6+
import { Icon } from "@mdi/react";
57
import React from "react";
68

79
const icon = {
@@ -11,7 +13,10 @@ const icon = {
1113
};
1214

1315
export default function TypeIcon({ type, ...props }) {
14-
return (
16+
const isString = typeof type === "string";
17+
return isString ? (
1518
<Icon path={icon[type]} {...props} />
19+
) : (
20+
<Icon path={type} {...props} />
1621
);
1722
}

frontend/components/organisms/ItemList/ItemList.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import React from "react";
33
import TypeIcon from "_atoms/TypeIcon";
44
import Item from "_molecules/Item";
55

6-
export default function ItemList({ items, title, iconType }) {
6+
export default function ItemList({ items, title, icon, iconType }) {
77
return (
88
<div className="item-list">
99
<div className="item-list-header">
10-
<TypeIcon type={iconType} size={1.5} opacity={0.7} />
11-
<div className="item-list-title">{title}</div>
10+
{iconType != null || icon != null ? (
11+
<TypeIcon type={iconType} path={icon} size={1.5} opacity={0.7} />
12+
) : null}
13+
{title && <div className="item-list-title">{title}</div>}
1214
</div>
1315
<Stack direction="row" className="item-list-content" spacing={2}>
1416
{items != null ? (

0 commit comments

Comments
 (0)