-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3592df
commit 4f2051c
Showing
2 changed files
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"Basic": "import { Toast, createToaster } from '@ark-ui/react'\n\nconst Basic = () => {\n const [Toaster, toast] = createToaster({\n placement: 'top-end',\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast.title}</Toast.Title>\n <Toast.Description>{toast.description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n return (\n <>\n <button onClick={() => toast.create({ title: 'Title', description: 'Description' })}>\n Toast\n </button>\n <Toaster />\n </>\n )\n}\n", | ||
"Basic": "import { Toast, createToaster } from '@ark-ui/react'\nimport { useEffect } from 'react'\n\nconst Basic = () => {\n const [Toaster, toast] = createToaster({\n placement: 'top-end',\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast.title}</Toast.Title>\n <Toast.Description>{toast.description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n useEffect(\n () => toast.subscribe((toasts) => toasts.forEach((toast) => console.log('Toast:', toast))),\n [toast],\n )\n\n const handleToast = () => {\n const id = toast.create({ title: 'Title', description: 'Description' })\n console.log('Toast ID:', id)\n }\n\n return (\n <>\n <button onClick={handleToast}>Toast</button>\n <Toaster />\n </>\n )\n}\n", | ||
"Customized": "import { Toast, createToaster } from '@ark-ui/react'\n\nconst Customized = () => {\n const [Toaster, toast] = createToaster({\n placement: 'bottom-start',\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast.title}</Toast.Title>\n <Toast.Description>{toast.description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n return (\n <>\n <button\n onClick={() =>\n toast.create({\n title: 'Success',\n description: 'This is a success toast',\n type: 'success',\n duration: 20000,\n removeDelay: 250,\n })\n }\n >\n Toast\n </button>\n <Toaster />\n </>\n )\n}\n", | ||
"CustomRender": "import { Toast, createToaster } from '@ark-ui/react'\n\nconst CustomRender = () => {\n const [Toaster, toast] = createToaster({\n placement: 'top-end',\n // custom render may go directly into the function below\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast.title}</Toast.Title>\n <Toast.Description>{toast.description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n return (\n <>\n <button\n onClick={() =>\n toast.create({\n title: 'Please checkout',\n render: (toast) => (\n <div>\n {toast.title} <a href=\"https://ark-ui.com\">Ark UI</a>\n </div>\n ),\n })\n }\n >\n Toast\n </button>\n <Toaster />\n </>\n )\n}\n" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"Basic": "import { Toast, createToaster } from '@ark-ui/solid'\n\nconst Basic = () => {\n const [Toaster, toast] = createToaster({\n placement: 'top-end',\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast().title}</Toast.Title>\n <Toast.Description>{toast().description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n return (\n <>\n <button onClick={() => toast().create({ title: 'Title', description: 'Description' })}>\n Toast\n </button>\n <Toaster />\n </>\n )\n}\n", | ||
"Basic": "import { Toast, createToaster } from '@ark-ui/solid'\nimport { createEffect } from 'solid-js'\n\nconst Basic = () => {\n const [Toaster, toast] = createToaster({\n placement: 'top-end',\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast().title}</Toast.Title>\n <Toast.Description>{toast().description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n createEffect(() =>\n toast().subscribe((toasts) => toasts.forEach((toast) => console.log('Toast:', toast))),\n )\n\n const handleToast = () => {\n const id = toast().create({ title: 'Title', description: 'Description' })\n console.log('Toast ID:', id)\n }\n\n return (\n <>\n <button onClick={handleToast}>Toast</button>\n <Toaster />\n </>\n )\n}\n", | ||
"Customized": "import { Toast, createToaster } from '@ark-ui/solid'\n\nconst Customized = () => {\n const [Toaster, toast] = createToaster({\n placement: 'bottom-start',\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast().title}</Toast.Title>\n <Toast.Description>{toast().description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n return (\n <>\n <button\n onClick={() =>\n toast().create({\n title: 'Success',\n description: 'This is a success toast',\n type: 'success',\n duration: 20000,\n removeDelay: 250,\n })\n }\n >\n Toast\n </button>\n <Toaster />\n </>\n )\n}\n", | ||
"CustomRender": "import { Toast, createToaster } from '@ark-ui/solid'\n\nconst CustomRender = () => {\n const [Toaster, toast] = createToaster({\n placement: 'top-end',\n // custom render may go directly into the function below\n render(toast) {\n return (\n <Toast.Root>\n <Toast.Title>{toast().title}</Toast.Title>\n <Toast.Description>{toast().description}</Toast.Description>\n <Toast.CloseTrigger>Close</Toast.CloseTrigger>\n </Toast.Root>\n )\n },\n })\n\n return (\n <>\n <button\n onClick={() =>\n toast().create({\n title: 'Please checkout',\n render: (toast) => (\n <div>\n {toast().title} <a href=\"https://ark-ui.com\">Ark UI</a>\n </div>\n ),\n })\n }\n >\n Toast\n </button>\n <Toaster />\n </>\n )\n}\n" | ||
} |