/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; interface Props { title?: string; hideIcon?: boolean; message: string | React.ReactNode; type: "info" | "warning" | "error" | "success"; slim?: boolean; } function Alert(props: Props) { let className = "usa-alert usa-alert--".concat(props.type); if (props.slim) { className += " usa-alert--slim"; } if (props.hideIcon) { className += " usa-alert--no-icon"; } return (
{typeof props.message === "object" ? ( props.message ) : (
{props.title && !props.slim && (

{props.title}

)}

{props.message}

)}
); } export default Alert;