From 6657dbe5551453fc9c95ce81f351cda71a59eb6d Mon Sep 17 00:00:00 2001 From: Johanna Szepanski <johanna.szepanski@softhouse.se> Date: Thu, 26 Sep 2024 16:10:18 +0200 Subject: [PATCH] migrated JobIcons to typescript --- .../Job/{JobIcons.js => JobIcons.tsx} | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) rename src/components/Job/{JobIcons.js => JobIcons.tsx} (82%) diff --git a/src/components/Job/JobIcons.js b/src/components/Job/JobIcons.tsx similarity index 82% rename from src/components/Job/JobIcons.js rename to src/components/Job/JobIcons.tsx index 9767ffce..7d73eca9 100644 --- a/src/components/Job/JobIcons.js +++ b/src/components/Job/JobIcons.tsx @@ -26,7 +26,7 @@ const SemiCircle = () => { ); }; -export const BatchJobIcon = ({ add }) => { +export const BatchJobIcon = ({ add = false }) => { return ( <Box sx={{ @@ -96,8 +96,21 @@ export const JobTypesComponent = { } }; -export const JobTypeIconText = ({ type, iconProps, fontProps }) => { - const Icon = JobTypesComponent[type].icon; +interface JobTypeIconTextProps { + type: string | undefined; +} + +export interface JobType { + DEPLOY: string; + UNDEPLOY: string; + BATCH_DEPLOY: string; + BATCH_UNDEPLOY: string; + START: string; + STOP: string; +} + +export const JobTypeIconText = ({ type }: JobTypeIconTextProps) => { + const Icon = JobTypesComponent[type as keyof JobType].icon; return ( <Stack @@ -107,9 +120,9 @@ export const JobTypeIconText = ({ type, iconProps, fontProps }) => { sx={{ width: "100%" }} > <Box sx={{ width: "26px", height: "24px" }}> - <Icon {...iconProps} /> + <Icon /> </Box> - <Typography {...fontProps}>{JobTypesComponent[type].label}</Typography> + <Typography>{JobTypesComponent[type as keyof JobType].label}</Typography> </Stack> ); }; -- GitLab