@planningcenter/alert

Planning Center Opinions for SweetAlert2

Usage no npm install needed!

<script type="module">
  import planningcenterAlert from 'https://cdn.skypack.dev/@planningcenter/alert';
</script>

README

@planningcenter/alert

A small wrapper around sweetalert2. This library will eventually use configuration and styles from @planningcenter/sweetalert2 once they are ready.

BETA ⚠️ This package currently houses the initial Alert implementation from People. It should be considered unstable until out of beta. Use at your own risk!

Interface

The new Alert interface takes cues from console and mirrors sweet alerts in passed arguments, but waves away some of the configuration.

i.e. Alert.error({ title: "Uh Oh!", text: "Something went wrong", })

Alert Methods: confirm, confirmCreate, confirmDestroy, error, info, success, and warn.

returns a Promise containing

{
  value: String, // on submit (confirm)
  dismiss: Boolean, // on cancel
}

Validations

The goal is to create validations that help us more closely align with global design patterns. The is some lightweight validation happening but for sake of time, we are only validating that there is text or html and title passed.

Headline (title) and Body (text) must be present.

reference: https://planningcenter.design/prompts