Use toast in photo share modal

This commit is contained in:
Sam Becker 2023-09-06 18:34:32 -05:00
parent a8d4ae7288
commit 2256c303f4
2 changed files with 3 additions and 11 deletions

View File

@ -6,11 +6,10 @@ import { absoluteRouteForPhoto, routeForPhoto } from '@/site/routes';
import { TbPhotoShare } from 'react-icons/tb';
import { cc } from '@/utility/css';
import { BiCopy } from 'react-icons/bi';
import { useState } from 'react';
import { Photo } from '.';
import { toast } from 'sonner';
export default function PhotoModal({ photo }: { photo: Photo }) {
const [copied, setIsCopied] = useState(false);
const shareUrl = absoluteRouteForPhoto(photo);
return (
@ -24,13 +23,6 @@ export default function PhotoModal({ photo }: { photo: Photo }) {
<div className="flex-grow">
Share Photo
</div>
{copied && <div className={cc(
'text-sm leading-none py-1.5 px-2',
'bg-blue-600 text-white',
'rounded-full',
)}>
Copied!
</div>}
</div>
<PhotoOGTile photo={photo} />
<div className={cc(
@ -52,7 +44,7 @@ export default function PhotoModal({ photo }: { photo: Photo }) {
)}
onClick={() => {
navigator.clipboard.writeText(shareUrl);
setIsCopied(true);
toast.success('Link to photo copied');
}}
>
<BiCopy size={18} />

View File

@ -139,7 +139,7 @@ export default function SiteChecklistClient({
<IconButton
onClick={() => {
navigator.clipboard.writeText(secret);
toast('Secret copied to clipboard', {
toast.success('Secret copied to clipboard', {
duration: 4000,
});
}}