Skip to content

Commit

Permalink
NotificationAlert: Float action to right, make children optional (#1110)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Valdivia <[email protected]>
  • Loading branch information
dvaldivia authored Nov 22, 2024
1 parent 8a128b4 commit 496d732
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type NotificationVariant =

export interface NotificationAlertBase {
title?: string;
children: ReactNode;
children?: ReactNode;
action?: ReactNode;
isLoading?: boolean;
onClose?: () => void; //If not set, we don't show the close button
Expand Down
20 changes: 16 additions & 4 deletions src/components/NotificationAlert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import InfoIcon from "../../icons/InfoIcon";
import XIcon from "../../icons/XIcon";
import { getNotificationAlertStyle } from "./NotificationAlert.styles";
import { NotificationAlertPrp } from "./NotificationAlert.types";
import Box from "../Box";

const Index: FC<NotificationAlertPrp & HTMLAttributes<HTMLDivElement>> = ({
title = "",
Expand Down Expand Up @@ -239,8 +240,17 @@ const Index: FC<NotificationAlertPrp & HTMLAttributes<HTMLDivElement>> = ({
<div className={"fillTitleContent"}>
{designMode === "banner" ? (
<Fragment>
<div className={"content"}>{children}</div>
{action && <div>{action}</div>}
{children && <div className={"content"}>{children}</div>}
<Box
sx={{
flexGrow: 1,
}}
/>
{action && (
<div className={"notifAction actionBannerMode"}>
{action}
</div>
)}
</Fragment>
) : (
<div className={"cardTitle"}>{title}</div>
Expand All @@ -249,8 +259,10 @@ const Index: FC<NotificationAlertPrp & HTMLAttributes<HTMLDivElement>> = ({
</div>
{designMode === "card" && (
<div className={"cardContent"}>
<div className={"content"}>{children}</div>
{action && <div className={"actionCardMode"}>{action}</div>}
{children && <div className={"content"}>{children}</div>}
{action && (
<div className={"notifAction actionCardMode"}>{action}</div>
)}
</div>
)}
</div>
Expand Down

0 comments on commit 496d732

Please sign in to comment.