105 lines
2.4 KiB
TypeScript
105 lines
2.4 KiB
TypeScript
export const basicToast=`
|
|
"use client"
|
|
import { Button } from "@/components/ui/button"
|
|
import { ToastAction } from "@/components/ui/toast"
|
|
import { useToast } from "@/components/ui/use-toast"
|
|
|
|
const BasicToast = () => {
|
|
const { toast } = useToast()
|
|
return (
|
|
<Button
|
|
variant="outline"
|
|
onClick={() => {
|
|
toast({
|
|
title: "Scheduled: Catch up ",
|
|
description: "Friday, February 10, 2023 at 5:57 PM",
|
|
action: (
|
|
<ToastAction altText="Goto schedule to undo">Undo</ToastAction>
|
|
),
|
|
})
|
|
}}
|
|
>
|
|
Add to calendar
|
|
</Button>
|
|
)
|
|
}
|
|
export default BasicToast;`
|
|
|
|
export const toastWithTitle=`"use client"
|
|
|
|
import { Button } from "@/components/ui/button"
|
|
import { useToast } from "@/components/ui/use-toast"
|
|
|
|
const ToastWithTitle = () => {
|
|
const { toast } = useToast()
|
|
|
|
return (
|
|
<Button
|
|
variant="outline"
|
|
onClick={() => {
|
|
toast({
|
|
title: "Uh oh! Something went wrong.",
|
|
description: "There was a problem with your request.",
|
|
})
|
|
}}
|
|
>
|
|
Show Toast
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
export default ToastWithTitle;`
|
|
|
|
export const toastWithAction=`"use client"
|
|
|
|
import { Button } from "@/components/ui/button"
|
|
import { ToastAction } from "@/components/ui/toast"
|
|
import { useToast } from "@/components/ui/use-toast"
|
|
|
|
const ToastWithAction = () => {
|
|
const { toast } = useToast()
|
|
|
|
return (
|
|
<Button
|
|
variant="outline"
|
|
onClick={() => {
|
|
toast({
|
|
title: "Uh oh! Something went wrong.",
|
|
description: "There was a problem with your request.",
|
|
action: <ToastAction altText="Try again">Try again</ToastAction>,
|
|
})
|
|
}}
|
|
>
|
|
Show Toast
|
|
</Button>
|
|
)
|
|
}
|
|
export default ToastWithAction;`
|
|
|
|
export const toastVariant=`"use client"
|
|
|
|
import { Button } from "@/components/ui/button"
|
|
import { ToastAction } from "@/components/ui/toast"
|
|
import { useToast } from "@/components/ui/use-toast"
|
|
|
|
const ToastVariant = () => {
|
|
const { toast } = useToast()
|
|
|
|
return (
|
|
<Button
|
|
variant="outline"
|
|
onClick={() => {
|
|
toast({
|
|
variant: "destructive",
|
|
title: "Uh oh! Something went wrong.",
|
|
description: "There was a problem with your request.",
|
|
action: <ToastAction altText="Try again">Try again</ToastAction>,
|
|
})
|
|
}}
|
|
>
|
|
Show Toast
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
export default ToastVariant;` |