Skip to content

Commit

Permalink
update share card
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed Mar 11, 2024
1 parent 2494e96 commit e03a53f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
Binary file added public/share-card-bg/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/app/[lang]/poem/[id]/components/share/draw/wu-yan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { cn } from "~/utils";
interface Props {
data: Poem & { author: Author };
className?: string;
bgImg: string;
}

export default function DrawWuYanPreview({ data, className }: Props) {
export default function DrawWuYanPreview({ data, className, bgImg }: Props) {
const content = data.content
.replace(/\n/g, "")
.match(/[^(?|,|。|!)]+(?|,|。|!)?|(?|,|。|!)/g)
Expand All @@ -22,7 +23,7 @@ export default function DrawWuYanPreview({ data, className }: Props) {
id="draw-share-card"
>
<img
src="/share-card-bg/1.png"
src={bgImg}
alt="background"
className="z-1 absolute left-0 top-0 h-full w-full"
/>
Expand Down
28 changes: 25 additions & 3 deletions src/app/[lang]/poem/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export default async function Page({ params, searchParams }: Props) {
title={
<>
<BookAIcon className="mr-2 h-5 w-5 text-primary" />
默认分享卡片
分享卡片默认
</>
}
>
Expand All @@ -268,11 +268,33 @@ export default async function Page({ params, searchParams }: Props) {
title={
<>
<Baby className="mr-2 h-5 w-5 text-primary" />
适合绝句
分享卡片绝句 Ⅰ
</>
}
>
<DrawWuYanPreview data={poem} className="bg-background" />
<DrawWuYanPreview
bgImg="/share-card-bg/1.png"
data={poem}
className="bg-background"
/>
</SaveShareButton>
)}

{poem.content.split(/,|?|。|!/).length <= 5 && (
<SaveShareButton
scale={2}
title={
<>
<Baby className="mr-2 h-5 w-5 text-primary" />
分享卡片绝句 Ⅱ
</>
}
>
<DrawWuYanPreview
bgImg="/share-card-bg/2.jpg"
data={poem}
className="bg-background"
/>
</SaveShareButton>
)}
</div>
Expand Down

0 comments on commit e03a53f

Please sign in to comment.