import React from "react"; import Hashids from "hashids"; import Modal, { IModal } from "./Modal"; import { IFrameworkStyle } from "../@types/style"; interface Props extends Omit { modalMessage: string modalTitle?: string modalAcceptInvert?: boolean modalAcceptLabel?: string modalAcceptColor?: string modalLoadAccept?: boolean modalRejectLabel?: string modalRejectColor?: string modalOptionsPosition?: "center" | "start" | "end" frameworkStyle?: IFrameworkStyle onModalAccept(): void } /** * Componente de Message * @param modalTitle * @param frameworkStyle * @param modalAcceptLabel * @param modalRejectLabel * @param modalOptionsPosition * @param props * @constructor */ const Message = ( { modalTitle = "Confirmação", frameworkStyle = "bootstrap", modalAcceptLabel = "Confirmar", modalRejectLabel = "Cancelar", modalOptionsPosition = "end", ...props }: Props) => { const rejectColor = !props.modalRejectColor ? "btn-danger text-white" : props.modalRejectColor; const acceptColor = !props.modalAcceptColor ? "btn-info text-white" : props.modalAcceptColor; const modalId = new Hashids(props.modalMessage).encode([1, 2, 3]); /* |-------------------------------------- | render() - Renderização do componente |-------------------------------------- */ return frameworkStyle === "bootstrap" ?

{props.modalMessage}

props.onModalVisible("closed")}> {modalRejectLabel} {props.modalLoadAccept ? <>
Loading...
Processando... : <>{modalAcceptLabel}}
: <>; }; export default Message;