-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create icon helper * change getStatusIcon to StatusIcon react component --------- Co-authored-by: Razboy20 <razboy20@gmail.com>
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<SVGSVGElement> & { status: Status }): React.ReactElement { | ||
const { status, ...rest } = props; | ||
|
||
switch (props.status) { | ||
case Status.WAITLISTED: | ||
return <WaitlistIcon {...rest} />; | ||
case Status.CLOSED: | ||
return <ClosedIcon {...rest} />; | ||
case Status.CANCELLED: | ||
return <CancelledIcon {...rest} />; | ||
default: | ||
} | ||
} |