feat(alert): expand alert popup func

This commit is contained in:
en 2025-02-14 13:00:59 +01:00
parent b71993adaa
commit 89d7131f7d

View File

@ -1,12 +1,16 @@
import { createPortal } from 'react-dom' import { createPortal } from 'react-dom'
import { PropsWithChildren } from 'react'
import { AlertPopupProps } from 'types' import { AlertPopupProps } from 'types'
export const AlertPopup = ({ export const AlertPopup = ({
header, header,
label, label,
handleConfirm, handleConfirm,
handleClose handleClose,
}: AlertPopupProps) => { yesButtonLabel = 'Yes',
noButtonLabel = 'No',
children
}: PropsWithChildren<AlertPopupProps>) => {
return createPortal( return createPortal(
<div className='popUpMain'> <div className='popUpMain'>
<div className='ContainerMain'> <div className='ContainerMain'>
@ -38,6 +42,7 @@ export const AlertPopup = ({
> >
{label} {label}
</label> </label>
{children}
</div> </div>
<div <div
style={{ style={{
@ -51,14 +56,14 @@ export const AlertPopup = ({
type='button' type='button'
onPointerDown={() => handleConfirm(true)} onPointerDown={() => handleConfirm(true)}
> >
Yes {yesButtonLabel}
</button> </button>
<button <button
className='btn btnMain btnMainPopup' className='btn btnMain btnMainPopup'
type='button' type='button'
onPointerDown={() => handleConfirm(false)} onPointerDown={() => handleConfirm(false)}
> >
No {noButtonLabel}
</button> </button>
</div> </div>
</div> </div>