Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I can center in my display #44

Open
christiantigre opened this issue Mar 5, 2020 · 1 comment
Open

How I can center in my display #44

christiantigre opened this issue Mar 5, 2020 · 1 comment

Comments

@christiantigre
Copy link

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
      });
    
  }
@gustavoghp87
Copy link

gustavoghp87 commented Mar 14, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants