|
1 | | -import { Alert } from '@heroui/alert' |
2 | | -import { Card, CardBody, CardHeader } from '@heroui/card' |
3 | | -import { Image } from '@heroui/image' |
4 | | -import { CalendarDays } from 'lucide-react' |
5 | | -import { formatDate } from '~/utils/time' |
6 | | -import { KunAvatar } from '~/components/kun/floating-card/KunAvatar' |
7 | | -import type { KunFrontmatter } from '~/lib/mdx/types' |
8 | | - |
9 | | -interface BlogHeaderProps { |
10 | | - frontmatter: KunFrontmatter |
11 | | -} |
12 | | - |
13 | | -export const BlogHeader = ({ frontmatter }: BlogHeaderProps) => { |
14 | | - return ( |
15 | | - <Card className="w-full space-y-4 overflow-visible bg-transparent border-none shadow-none"> |
16 | | - <CardHeader className="flex flex-col items-start p-0"> |
17 | | - <div className="relative w-full overflow-hidden rounded-xl"> |
18 | | - <Image |
19 | | - isZoomed |
20 | | - alt={frontmatter.title} |
21 | | - className="object-cover" |
22 | | - src={frontmatter.banner} |
23 | | - width="100%" |
24 | | - height="100%" |
25 | | - /> |
26 | | - </div> |
27 | | - </CardHeader> |
28 | | - |
29 | | - <CardBody className="p-0 overflow-visible"> |
30 | | - <div className="flex flex-col space-y-4"> |
31 | | - <h1 className="text-2xl font-bold tracking-tight sm:text-4xl"> |
32 | | - {frontmatter.title} |
33 | | - </h1> |
34 | | - |
35 | | - <div className="flex items-center gap-3"> |
36 | | - <KunAvatar |
37 | | - uid={frontmatter.authorUid} |
38 | | - avatarProps={{ |
39 | | - isBordered: true, |
40 | | - radius: 'full', |
41 | | - size: 'md', |
42 | | - name: frontmatter.authorName, |
43 | | - src: frontmatter.authorAvatar, |
44 | | - className: 'shrink-0' |
45 | | - }} |
46 | | - /> |
47 | | - <div className="flex flex-col gap-1"> |
48 | | - <h2 className="font-semibold leading-none text-small"> |
49 | | - {frontmatter.authorName} |
50 | | - </h2> |
51 | | - <div className="flex items-center gap-2"> |
52 | | - <CalendarDays className="w-4 h-4 text-default-400" /> |
53 | | - <p className="text-small text-default-400"> |
54 | | - {formatDate(frontmatter.date, { |
55 | | - isPrecise: true, |
56 | | - isShowYear: true |
57 | | - })} |
58 | | - </p> |
59 | | - </div> |
60 | | - </div> |
61 | | - </div> |
62 | | - |
63 | | - <Alert |
64 | | - hideIcon |
65 | | - description={frontmatter.description} |
66 | | - color="primary" |
67 | | - /> |
68 | | - </div> |
69 | | - </CardBody> |
70 | | - </Card> |
71 | | - ) |
72 | | -} |
| 1 | +import { Alert } from '@heroui/alert' |
| 2 | +import { Card, CardBody, CardHeader } from '@heroui/card' |
| 3 | +import { Image } from '@heroui/image' |
| 4 | +import { CalendarDays } from 'lucide-react' |
| 5 | +import { formatDate } from '~/utils/time' |
| 6 | +import { KunAvatar } from '~/components/kun/floating-card/KunAvatar' |
| 7 | +import type { KunFrontmatter } from '~/lib/mdx/types' |
| 8 | + |
| 9 | +interface BlogHeaderProps { |
| 10 | + frontmatter: KunFrontmatter |
| 11 | +} |
| 12 | + |
| 13 | +export const BlogHeader = ({ frontmatter }: BlogHeaderProps) => { |
| 14 | + return ( |
| 15 | + <Card className="w-full space-y-4 overflow-visible bg-transparent border-none shadow-none"> |
| 16 | + <CardHeader className="flex flex-col items-start p-0"> |
| 17 | + <div className="relative w-full overflow-hidden rounded-xl"> |
| 18 | + <Image |
| 19 | + alt={frontmatter.title} |
| 20 | + className="object-cover" |
| 21 | + src={frontmatter.banner} |
| 22 | + width="100%" |
| 23 | + height="100%" |
| 24 | + /> |
| 25 | + </div> |
| 26 | + </CardHeader> |
| 27 | + |
| 28 | + <CardBody className="p-0 overflow-visible"> |
| 29 | + <div className="flex flex-col space-y-4"> |
| 30 | + <h1 className="text-2xl mt-8 font-bold tracking-tight sm:text-4xl"> |
| 31 | + {frontmatter.title} |
| 32 | + </h1> |
| 33 | + |
| 34 | + <div className="flex items-center gap-3"> |
| 35 | + <KunAvatar |
| 36 | + uid={frontmatter.authorUid} |
| 37 | + avatarProps={{ |
| 38 | + isBordered: true, |
| 39 | + radius: 'full', |
| 40 | + size: 'md', |
| 41 | + name: frontmatter.authorName, |
| 42 | + src: frontmatter.authorAvatar, |
| 43 | + className: 'shrink-0' |
| 44 | + }} |
| 45 | + /> |
| 46 | + <div className="flex flex-col gap-1"> |
| 47 | + <h2 className="font-semibold leading-none text-small"> |
| 48 | + {frontmatter.authorName} |
| 49 | + </h2> |
| 50 | + <div className="flex items-center gap-2"> |
| 51 | + <CalendarDays className="w-4 h-4 text-default-400" /> |
| 52 | + <p className="text-small text-default-400"> |
| 53 | + {formatDate(frontmatter.date, { |
| 54 | + isPrecise: true, |
| 55 | + isShowYear: true |
| 56 | + })} |
| 57 | + </p> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + |
| 62 | + <Alert |
| 63 | + hideIcon |
| 64 | + description={frontmatter.description} |
| 65 | + color="primary" |
| 66 | + /> |
| 67 | + </div> |
| 68 | + </CardBody> |
| 69 | + </Card> |
| 70 | + ) |
| 71 | +} |
0 commit comments