Skip to content

Commit

Permalink
Merge pull request #80 from besscroft/dev
Browse files Browse the repository at this point in the history
v0.9.1
  • Loading branch information
besscroft authored Jun 29, 2024
2 parents 185445b + 427af73 commit 52bc7c3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Bess Croft
Copyright (c) 2024-PRESENT Bess Croft<https://github.com/besscroft>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions components/Masonry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { toast } from 'sonner'
import { useSearchParams } from 'next/navigation'
import BlurImage from '~/components/BlurImage'
import { useButtonStore } from '~/app/providers/button-store-Providers'
import { FloatButton } from 'antd'

export default function Masonry(props : Readonly<ImageHandleProps>) {
const { data: pageTotal } = useSWRPageTotalHook(props)
Expand Down Expand Up @@ -96,6 +97,7 @@ export default function Masonry(props : Readonly<ImageHandleProps>) {
</Button>
}
</div>
<FloatButton.BackTop />
<MasonryItem />
</div>
)
Expand Down
29 changes: 28 additions & 1 deletion components/MasonryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { useButtonStore } from '~/app/providers/button-store-Providers'
import { CopyrightType, DataProps, ImageType } from '~/types'
import { Image, Tabs, Tab, Card, CardHeader, CardBody, CardFooter, Button, Chip, Link, Avatar } from '@nextui-org/react'
import { Aperture, Camera, Image as ImageIcon, Languages, CalendarDays, X, SunMedium, MoonStar, Copyright, Crosshair, Timer, CircleGauge, Copy } from 'lucide-react'
import { Aperture, Camera, Image as ImageIcon, Languages, CalendarDays, X, SunMedium, MoonStar, Copyright, Crosshair, Timer, CircleGauge, Copy, Share2 } from 'lucide-react'
import * as React from 'react'
import { useTheme } from 'next-themes'
import { useRouter } from 'next-nprogress-bar'
Expand All @@ -27,6 +27,23 @@ export default function MasonryItem() {
data: MasonryViewData,
}

async function handleOnClick() {
const url = window.location.origin + (pathname === '/' ? '/preview/' : pathname + '/preview/') + MasonryViewData.id
if (navigator.canShare({ url })) {
try {
await navigator.share({
title: MasonryViewData.title,
text: MasonryViewData.detail,
url: url
});
} catch (error) {
toast.warning('分享发生错误!', { duration: 500 })
}
} else {
toast.warning('您的浏览器不支持!', { duration: 500 })
}
}

return (
<Dialog
defaultOpen={false}
Expand All @@ -44,6 +61,16 @@ export default function MasonryItem() {
<p>{MasonryViewData.title}</p>
</div>
<div className="flex items-center space-x-4">
<Button
isIconOnly
variant="shadow"
size="sm"
aria-label="分享"
className="bg-white dark:bg-gray-800"
onClick={() => handleOnClick()}
>
<Share2 size={20}/>
</Button>
<Button
isIconOnly
variant="shadow"
Expand Down
4 changes: 4 additions & 0 deletions style/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
display: none;
}

.ant-float-btn {
z-index: 30;
}

.ant-upload-select {
display: block !important;
}
Expand Down

0 comments on commit 52bc7c3

Please sign in to comment.