From ccea0f4bd1e8d66dc0717d92c9e970040d9fbe9e Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 5 Feb 2024 18:24:02 -0600 Subject: [PATCH] feat: Create icon helper (#77) * create icon helper * change getStatusIcon to StatusIcon react component --------- Co-authored-by: Razboy20 --- src/shared/util/icons.tsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/shared/util/icons.tsx diff --git a/src/shared/util/icons.tsx b/src/shared/util/icons.tsx new file mode 100644 index 000000000..88f4ebfda --- /dev/null +++ b/src/shared/util/icons.tsx @@ -0,0 +1,24 @@ +import React, { SVGProps } from 'react'; +import ClosedIcon from '~icons/material-symbols/lock'; +import WaitlistIcon from '~icons/material-symbols/timelapse'; +import CancelledIcon from '~icons/material-symbols/warning'; +import { Status } from '../types/Course'; + +/** + * Get Icon component based on status + * @param props.status status + * @returns React.ReactElement - the icon component + */ +export function StatusIcon(props: SVGProps & { status: Status }): React.ReactElement { + const { status, ...rest } = props; + + switch (props.status) { + case Status.WAITLISTED: + return ; + case Status.CLOSED: + return ; + case Status.CANCELLED: + return ; + default: + } +}