Extract URL copied and Remixed toasts into files
This commit is contained in:
parent
b8d4529f21
commit
7c3f03f20e
2 changed files with 88 additions and 0 deletions
49
components/toasts/RemixedToast/index.tsx
Normal file
49
components/toasts/RemixedToast/index.tsx
Normal 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
|
||||
39
components/toasts/UrlCopiedToast/index.tsx
Normal file
39
components/toasts/UrlCopiedToast/index.tsx
Normal 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
|
||||
Loading…
Reference in a new issue