chore: Update to ESLint 9 * wip: apply codemod and upgrade swc plugin * Update eslint to 9 in scandic-web apply code mod to config fix existing lint issues * Remove uneccessary fixupConfigRules * Update eslint to 9 in design-system * Add lint turbo dependency * Move redis-api to eslint and prettier instead of biome * Simplify eslint configs * Clean up * Apply linting Approved-by: Linus Flood
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import {
|
|
MaterialIcon,
|
|
type MaterialIconSetIconProps,
|
|
} from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|
|
|
import type { JSX } from "react"
|
|
|
|
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}
|
|
/>
|
|
)
|
|
}
|
|
}
|