snowballtools-base/packages/frontend/src/pages/components/renders/toast.tsx
2024-02-22 17:07:15 +07:00

67 lines
1.6 KiB
TypeScript

import React from 'react';
import { Button } from 'components/shared/Button';
import { useToast } from 'components/shared/Toast';
export const renderToastsWithCta = () => {
const { toast, dismiss } = useToast();
return (
<div className="flex gap-10">
{(['success', 'error', 'warning', 'info', 'loading'] as const).map(
(variant, index) => (
<Button
onClick={() =>
toast({
onDismiss: dismiss,
id: `${variant}_${index}`,
title: 'Project created',
cta: [
{
buttonLabel: 'Button',
size: 'xs',
variant: 'tertiary',
},
{
buttonLabel: 'Button',
size: 'xs',
},
],
variant,
})
}
key={`${variant}_${index}`}
>
{variant} with cta
</Button>
),
)}
</div>
);
};
export const renderToast = () => {
const { toast, dismiss } = useToast();
return (
<div className="flex gap-10">
{(['success', 'error', 'warning', 'info', 'loading'] as const).map(
(variant, index) => (
<Button
onClick={() =>
toast({
onDismiss: dismiss,
id: `${variant}_${index}`,
title: 'Project created',
variant,
})
}
key={`${variant}_${index}`}
>
{variant}
</Button>
),
)}
</div>
);
};