From b1930aebfc649a16e0776e327861c4e8adc81072 Mon Sep 17 00:00:00 2001 From: ilia makarov Date: Mon, 13 Nov 2023 10:41:34 +0200 Subject: [PATCH] Added icon to Team field --- src/components/common/Team/Team.tsx | 10 +++----- src/components/common/Team/icons.ts | 37 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 src/components/common/Team/icons.ts diff --git a/src/components/common/Team/Team.tsx b/src/components/common/Team/Team.tsx index 211c1ae..b88316a 100644 --- a/src/components/common/Team/Team.tsx +++ b/src/components/common/Team/Team.tsx @@ -1,9 +1,8 @@ import styled from "styled-components"; +import get from "lodash/get"; import toLower from "lodash/toLower"; -import { match } from "ts-pattern"; -import { faCrown } from "@fortawesome/free-solid-svg-icons"; -import { faGitlab } from "@fortawesome/free-brands-svg-icons"; import { P5, Icon, Stack } from "@deskpro/deskpro-ui"; +import { icons } from "./icons"; import type { FC } from "react"; import type { AnyIcon } from "@deskpro/deskpro-ui"; import type { Issue } from "../../../services/linear/types"; @@ -31,10 +30,7 @@ const Team: FC = ({ team }) => { ); } - const teamIcon = match(toLower(icon)) - .with("crown", () => faCrown) - .with("gitlab", () => faGitlab) - .otherwise(() => undefined); + const teamIcon = get(icons, toLower(icon)); return ( diff --git a/src/components/common/Team/icons.ts b/src/components/common/Team/icons.ts new file mode 100644 index 0000000..06d2431 --- /dev/null +++ b/src/components/common/Team/icons.ts @@ -0,0 +1,37 @@ +import { + faCrown, + faUserGroup, + faSatelliteDish, + faGamepad, + faBatteryFull, + faVolumeOff, + faDatabase, + faTerminal, + faClock, + faStopwatch, + faUnlockKeyhole, + faCompass, + faServer, +} from "@fortawesome/free-solid-svg-icons"; +import { faGitlab } from "@fortawesome/free-brands-svg-icons"; + +const icons = { + crown: faCrown, + gitlab: faGitlab, + team: faUserGroup, + radar: faSatelliteDish, + chip: undefined, + joystick: faGamepad, + battery: faBatteryFull, + sound: faVolumeOff, + cone: undefined, + database: faDatabase, + terminal: faTerminal, + watch: faClock, + clock: faStopwatch, + lock: faUnlockKeyhole, + compass: faCompass, + server: faServer, +}; + +export { icons };