import * as React from "react"; import { cx } from "@emotion/css"; import { messagePanelContainer, vertAlignHeading } from "../style"; import { Card } from "../../card"; import { SpacingBox } from "../../styleUtils/modifiers"; import { HeadingText2 } from "../../styleUtils/typography"; import { breakWord } from "../../shared/styles/styleUtils"; import MessagePanelActions from "./MessagePanelActions"; import { Icon } from "../../icon"; import { SystemIcons } from "../../icons/dist/system-icons-enum"; import { themeError } from "../../design-tokens/build/js/designTokens"; export interface MessagePanelProps { /** * The tone of the message */ appearance?: "error" | "standard"; /** * A heading to provide a brief overview of why an empty state is appearing */ heading: string; /** * The most important action a user can take in the empty state */ primaryAction?: React.ReactNode; /** * A secondary action a user can take in the empty state */ secondaryAction?: React.ReactNode; /** * Allows custom styling */ className?: string; /** * Human-readable selector used for writing tests */ "data-cy"?: string; children: React.ReactNode; } const MessagePanel = ({ appearance = "standard", heading, children, primaryAction, secondaryAction, className, "data-cy": dataCy = "messagePanel" }: MessagePanelProps) => { const hasActions = primaryAction || secondaryAction; return (
{appearance === "error" ? ( <> {heading} ) : ( heading )} {children && ( {children} )} {(primaryAction || secondaryAction) && ( )}
); }; export default MessagePanel;