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
This commit is contained in:
@@ -41,7 +41,11 @@ export default function Alert({
|
|||||||
<section className={classNames} role={ariaRole} aria-live={ariaLive}>
|
<section className={classNames} role={ariaRole} aria-live={ariaLive}>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<span className={styles.iconWrapper}>
|
<span className={styles.iconWrapper}>
|
||||||
<IconByAlertType alertType={type} className={styles.icon} />
|
<IconByAlertType
|
||||||
|
alertType={type}
|
||||||
|
className={styles.icon}
|
||||||
|
variant={variant}
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
<div className={styles.innerContent}>
|
<div className={styles.innerContent}>
|
||||||
<div className={styles.textWrapper}>
|
<div className={styles.textWrapper}>
|
||||||
|
|||||||
@@ -4,25 +4,35 @@ import {
|
|||||||
} from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
} from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
|
|
||||||
import { AlertTypeEnum } from "@/types/enums/alert"
|
import { AlertTypeEnum } from "@/types/enums/alert"
|
||||||
|
import type { AlertProps } from "./alert"
|
||||||
|
|
||||||
interface IconByAlertProps {
|
interface IconByAlertProps {
|
||||||
alertType: AlertTypeEnum
|
alertType: AlertTypeEnum
|
||||||
|
variant?: AlertProps["variant"]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function IconByAlertType({
|
export function IconByAlertType({
|
||||||
alertType,
|
alertType,
|
||||||
|
variant = "inline",
|
||||||
...props
|
...props
|
||||||
}: IconByAlertProps & MaterialIconSetIconProps): JSX.Element {
|
}: IconByAlertProps & MaterialIconSetIconProps): JSX.Element {
|
||||||
switch (alertType) {
|
switch (alertType) {
|
||||||
case AlertTypeEnum.Alarm:
|
case AlertTypeEnum.Alarm:
|
||||||
return (
|
return (
|
||||||
<MaterialIcon color="Icon/Inverted" isFilled icon="cancel" {...props} />
|
<MaterialIcon
|
||||||
|
color={variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Error"}
|
||||||
|
isFilled
|
||||||
|
icon="error"
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
case AlertTypeEnum.Warning:
|
case AlertTypeEnum.Warning:
|
||||||
return (
|
return (
|
||||||
<MaterialIcon
|
<MaterialIcon
|
||||||
icon="warning"
|
icon="warning"
|
||||||
color="Icon/Inverted"
|
color={
|
||||||
|
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Warning"
|
||||||
|
}
|
||||||
isFilled
|
isFilled
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
@@ -30,7 +40,14 @@ export function IconByAlertType({
|
|||||||
case AlertTypeEnum.Info:
|
case AlertTypeEnum.Info:
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<MaterialIcon color="Icon/Inverted" isFilled icon="info" {...props} />
|
<MaterialIcon
|
||||||
|
color={
|
||||||
|
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Information"
|
||||||
|
}
|
||||||
|
isFilled
|
||||||
|
icon="info"
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user