feat!: move from react-toastify to sonner (#6682)

**BREAKING:** We now export toast from `sonner` instead of
`react-toastify`. If you send out toasts from your own projects, make
sure to use our `toast` export, or install `sonner`. React-toastify
toasts will no longer work anymore. The Toast APIs are mostly similar,
but there are some differences if you provide options to your toast

CSS styles have been changed from Toastify

```css
/* before */
.Toastify


/* current */
.payload-toast-container
.payload-toast-item
.payload-toast-close-button

/* individual toast items will also have these classes depending on the state */
.toast-info
.toast-warning
.toast-success
.toast-error
```


https://github.com/payloadcms/payload/assets/70709113/da3e732e-aafc-4008-9469-b10f4eb06b35

---------

Co-authored-by: Paul Popus <paul@nouance.io>
This commit is contained in:
Alessio Gravili
2024-06-11 14:12:59 -04:00
committed by GitHub
parent 10c6ffafc3
commit cb3355b30f
87 changed files with 747 additions and 353 deletions

View File

@@ -177,7 +177,7 @@ export async function saveDocHotkeyAndAssert(page: Page): Promise<void> {
await page.keyboard.down('Control')
}
await page.keyboard.down('s')
await expect(page.locator('.Toastify')).toContainText('successfully')
await expect(page.locator('.payload-toast-container')).toContainText('successfully')
}
export async function saveDocAndAssert(
@@ -189,10 +189,10 @@ export async function saveDocAndAssert(
await page.click(selector, { delay: 100 })
if (expectation === 'success') {
await expect(page.locator('.Toastify')).toContainText('successfully')
await expect(page.locator('.payload-toast-container')).toContainText('successfully')
await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).not.toContain('create')
} else {
await expect(page.locator('.Toastify .Toastify__toast--error')).toBeVisible()
await expect(page.locator('.payload-toast-container .toast-error')).toBeVisible()
}
}