'use client' import { RiAlertFill, RiCheckboxCircleFill, RiErrorWarningFill, RiInformation2Fill } from '@remixicon/react' import type { FC } from 'react' import React from 'react' import cn from '@/utils/classnames' import Divider from '@/app/components/base/divider' type Status = 'success' | 'error' | 'warning' | 'info' type Props = { type?: Status description: string actionText: string onAction: () => void disabled?: boolean } const IconMap = { success: { Icon: RiCheckboxCircleFill, color: 'text-text-success', }, error: { Icon: RiErrorWarningFill, color: 'text-text-destructive', }, warning: { Icon: RiAlertFill, color: 'text-text-warning-secondary', }, info: { Icon: RiInformation2Fill, color: 'text-text-accent', }, } const getIcon = (type: Status) => { return IconMap[type] } const StatusAction: FC = ({ type = 'info', description, actionText, onAction, disabled, }) => { const { Icon, color } = getIcon(type) return (
{description}
{actionText}
) } export default React.memo(StatusAction)