move move frontend to progress-test
This commit is contained in:
46
app/javascript/components/Dialog/Dialog.tsx
Normal file
46
app/javascript/components/Dialog/Dialog.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import React, { FC } from "react"
|
||||
import { Button } from "../Button"
|
||||
import { Modal } from '../Modal'
|
||||
|
||||
type DialogType = 'confirmation' | 'notice'
|
||||
|
||||
type Props = {
|
||||
type?: DialogType
|
||||
title: string
|
||||
isOpen?: boolean
|
||||
text?: any
|
||||
setIsOpen: (state: boolean) => void
|
||||
onConfirmation: () => void
|
||||
};
|
||||
|
||||
export const Dialog: FC<Props> = ({
|
||||
type = 'confirmation',
|
||||
title,
|
||||
isOpen: open = false,
|
||||
setIsOpen,
|
||||
onConfirmation,
|
||||
text,
|
||||
}) => {
|
||||
return (
|
||||
<Modal
|
||||
title={title}
|
||||
isOpen={open}
|
||||
setIsOpen={setIsOpen}
|
||||
buttons={
|
||||
<>
|
||||
{type === 'confirmation' &&
|
||||
<Button onClick={() => setIsOpen(false)}>
|
||||
Cancelar
|
||||
</Button>
|
||||
}
|
||||
<Button type="primary" onClick={onConfirmation}>
|
||||
Confirmar
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{text}
|
||||
</Modal>
|
||||
)
|
||||
};
|
||||
|
||||
1
app/javascript/components/Dialog/index.ts
Normal file
1
app/javascript/components/Dialog/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./Dialog";
|
||||
Reference in New Issue
Block a user