react-confirm-alert icon indicating copy to clipboard operation
react-confirm-alert copied to clipboard

How I can center in my display

Open christiantigre opened this issue 4 years ago • 1 comments

hi, how I can apply style in my component. I try, style: "center"

closeModule() {
    
      confirmAlert({
        title: "Alerta",
        message: "Desea salir sin aplicar los cambios ?",
        style: "center",
        buttons: [
          {
            label: "Si",
            onClick: () => this._closeModule()
          },
          {
            label: "No",
            onClick: () => ""
          }
        ],
        closeOnEscape: false,
        closeOnClickOutside: false
      });
    
  }

christiantigre avatar Mar 05 '20 21:03 christiantigre

Hi! I was able to do it by this way (I use bootstrap and typescript):

confirmAlert({
    (...)
})

setTimeout(() => {
    const bodyElements: HTMLCollectionOf<Element> = document.getElementsByClassName('react-confirm-alert-body')
    bodyElements[0]?.classList?.add('text-center')
    bodyElements[0]?.firstElementChild?.classList?.add('h3')
    bodyElements[0]?.firstElementChild?.classList?.add('mb-3')
    const buttonGroupElements: HTMLCollectionOf<Element> =
        document.getElementsByClassName('react-confirm-alert-button-group')
    buttonGroupElements[0]?.classList?.add('d-block')
    buttonGroupElements[0]?.classList?.add('m-auto')
    buttonGroupElements[0]?.classList?.add('mt-4')
    buttonGroupElements[0]?.firstElementChild?.classList?.add('bg-danger')
}, 200)

gustavoghp87 avatar Mar 14 '22 11:03 gustavoghp87