Extract URL copied and Remixed toasts into files

This commit is contained in:
Justin Edmund 2023-04-16 03:50:35 -07:00
parent b8d4529f21
commit 7c3f03f20e
2 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,49 @@
import React from 'react'
import Toast from '~components/common/Toast'
import { Trans, useTranslation } from 'next-i18next'
import './index.scss'
interface Props {
partyName: string
open: boolean
onActionClick?: () => void
onOpenChange: (open: boolean) => void
onCloseClick: () => void
}
const RemixedToast = ({
partyName,
open,
onOpenChange,
onCloseClick,
}: Props) => {
const { t } = useTranslation('common')
// Methods: Event handlers
function handleOpenChange() {
onOpenChange(open)
}
function handleCloseClick() {
onCloseClick()
}
return (
<Toast
altText={t('toasts.remixed', { title: partyName })}
open={open}
duration={2400}
type="foreground"
content={
<Trans i18nKey="toasts.remixed">
You remixed <strong>{{ title: partyName }}</strong>
</Trans>
}
onOpenChange={handleOpenChange}
onCloseClick={handleCloseClick}
/>
)
}
export default RemixedToast

View file

@ -0,0 +1,39 @@
import React from 'react'
import Toast from '~components/common/Toast'
import './index.scss'
import { useTranslation } from 'next-i18next'
interface Props {
open: boolean
onActionClick?: () => void
onOpenChange: (open: boolean) => void
onCloseClick: () => void
}
const UrlCopiedToast = ({ open, onOpenChange, onCloseClick }: Props) => {
const { t } = useTranslation('common')
// Methods: Event handlers
function handleOpenChange() {
onOpenChange(open)
}
function handleCloseClick() {
onCloseClick()
}
return (
<Toast
altText={t('toasts.copied')}
open={open}
duration={2400}
type="foreground"
content={t('toasts.copied')}
onOpenChange={handleOpenChange}
onCloseClick={handleCloseClick}
/>
)
}
export default UrlCopiedToast