import { Cross } from '@transferwise/icons'; import { clsx } from 'clsx'; import SentimentSurface, { Sentiment } from '../../sentimentSurface'; import IconButton from '../../iconButton'; import { useIntl } from 'react-intl'; import closeBtnMessages from '../../common/closeButton/CloseButton.messages'; import { HTMLAttributes, ReactNode } from 'react'; export type PrimitivePromptProps = HTMLAttributes & { /** * The sentiment determines the colour scheme * @default success */ sentiment?: Sentiment; /** * Media to be displayed on the prompt (icon/image/etc). */ media: ReactNode; /** * Any actions to be displayed on the prompt. */ actions?: ReactNode; /** * Handler called when the close button is clicked. If not provided, then the close button is hidden. */ onDismiss?: () => void; /** * Test ID for testing tools */ 'data-testid'?: string; }; /** * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts. * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */ export const PrimitivePrompt = ({ sentiment = 'success', media, actions, onDismiss, className, children, ...restProps }: PrimitivePromptProps) => { const intl = useIntl(); return (
{media}
{children} {onDismiss && ( )} {actions &&
{actions}
}
); };