Add altText prop to Toast

We changed things so we could insert React elements into the content field.
This commit is contained in:
Justin Edmund 2023-01-28 21:29:22 -08:00
parent 8c480810b9
commit 6bc887c95b
3 changed files with 6 additions and 1 deletions

View file

@ -225,6 +225,7 @@ const Header = () => {
const urlCopyToast = () => {
return (
<Toast
altText={t('toasts.copied')}
open={copyToastOpen}
duration={2400}
type="foreground"
@ -238,6 +239,7 @@ const Header = () => {
const remixToast = () => {
return (
<Toast
altText={t('toasts.remixed', { title: originalName })}
open={remixToastOpen}
duration={2400}
type="foreground"

View file

@ -5,6 +5,7 @@ import * as ToastPrimitive from '@radix-ui/react-toast'
import './index.scss'
interface Props extends ToastPrimitive.ToastProps {
altText: string
className?: string
title?: string
content: React.ReactNode
@ -12,6 +13,7 @@ interface Props extends ToastPrimitive.ToastProps {
}
const Toast = ({
altText,
children,
title,
content,
@ -39,7 +41,7 @@ const Toast = ({
<p>{content}</p>
</ToastPrimitive.Description>
{children && (
<ToastPrimitive.Action asChild altText="">
<ToastPrimitive.Action asChild altText={altText}>
{children}
</ToastPrimitive.Action>
)}

View file

@ -54,6 +54,7 @@ const UpdateToast = ({
return (
<Toast
altText={t(`toasts.description.${updateType}`)}
className={classes}
title={t(`toasts.title`)}
content={t(`toasts.description.${updateType}`)}