Files
web/apps/scandic-web/components/TempDesignSystem/Alert/utils.tsx
Matilda Landström bbe04e3cb0 Merged in fix/alert-icon (pull request #2139)
fix(SW-2807): alert icons

* fix(SW-2807): fix incorrect icon color on sitewide alert

* fix(SW-2807): change error icon


Approved-by: Erik Tiekstra
Approved-by: Linus Flood
2025-05-19 11:22:38 +00:00

54 lines
1.2 KiB
TypeScript

import {
MaterialIcon,
type MaterialIconSetIconProps,
} from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { AlertTypeEnum } from "@/types/enums/alert"
import type { AlertProps } from "./alert"
interface IconByAlertProps {
alertType: AlertTypeEnum
variant?: AlertProps["variant"]
}
export function IconByAlertType({
alertType,
variant = "inline",
...props
}: IconByAlertProps & MaterialIconSetIconProps): JSX.Element {
switch (alertType) {
case AlertTypeEnum.Alarm:
return (
<MaterialIcon
color={variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Error"}
isFilled
icon="error"
{...props}
/>
)
case AlertTypeEnum.Warning:
return (
<MaterialIcon
icon="warning"
color={
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Warning"
}
isFilled
{...props}
/>
)
case AlertTypeEnum.Info:
default:
return (
<MaterialIcon
color={
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Information"
}
isFilled
icon="info"
{...props}
/>
)
}
}