Skip to content

Commit d84682e

Browse files
committed
update suggested blog to sticky notes
1 parent 911a388 commit d84682e

File tree

2 files changed

+50
-20
lines changed

2 files changed

+50
-20
lines changed

src/modules/blog/BlogCardPreview.tsx

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,34 @@ type Props = {
1212
export const BlogCardPreview = ({blog}: Props) => {
1313
const {t} = useTranslation('common');
1414

15+
// Generate random rotations for note and stamp
16+
const noteRotation = Math.random() * 6 - 3;
17+
const stampRotation = Math.random() * 10 - 5;
18+
1519
return (
16-
<figure className="relative w-ful min-h-[20rem] text-center overflow-hidden shadow-sm hover:shadow-md hover:shadow-neutral-800 shadow-neutral-800 rounded-2xl bg-light md:max-w-4xl">
17-
<NextLink href={`/blog/${blog.slug}`} aria-label={blog.title}>
18-
<Image
19-
src={blog.bannerId}
20-
alt={blog.bannerDescription}
21-
title={blog.bannerDescription}
22-
fill={true}
23-
className="object-cover"
24-
placeholder="blur"
25-
blurDataURL={blog.bannerId}
26-
/>
27-
<figcaption className="absolute bottom-0 w-full bg-neutral-100 dark:bg-neutral-800 pb-4 opacity-[0.98] px-4 md:h-[10rem] flex flex-col justify-between">
28-
<h2 className="line-clamp-2 text-balance text-xl">{blog.title}</h2>
29-
<div>
30-
<p className="line-clamp-1">{blog.description}</p>
31-
<p className="mt-2 text-neutral-700 dark:text-neutral-300">
20+
<NextLink href={`/blog/${blog.slug}`} aria-label={blog.title}>
21+
<div
22+
className="relative min-h-[16rem] w-full md:max-w-md p-6 m-4 bg-yellow-100 dark:bg-yellow-200
23+
hover:shadow-lg transition-all duration-300 cursor-pointer"
24+
style={{
25+
transform: `rotate(${noteRotation}deg)`,
26+
boxShadow: '2px 3px 15px rgba(0,0,0,0.15)',
27+
clipPath: 'polygon(0% 0%, 100% 1%, 100% 100%, 1% 100%)',
28+
}}
29+
>
30+
<div className="absolute top-0 right-0 w-0 h-0 border-0 border-t-[40px] border-r-[40px] border-t-yellow-200 border-r-yellow-300 dark:border-t-yellow-300 dark:border-r-yellow-400" />
31+
32+
<div className="flex flex-col h-full">
33+
<h2 className="mb-4 text-2xl font-bold text-neutral-800 line-clamp-2 text-balance">
34+
{blog.title}
35+
</h2>
36+
37+
<p className="flex-grow mb-4 text-neutral-700 line-clamp-3">
38+
{blog.description}
39+
</p>
40+
41+
<div className="flex justify-between items-end">
42+
<p className="text-sm text-neutral-600 italic">
3243
{t('date', {
3344
val: new Date(blog.date),
3445
formatParams: {
@@ -41,9 +52,28 @@ export const BlogCardPreview = ({blog}: Props) => {
4152
},
4253
})}
4354
</p>
55+
56+
{/* Stamp-like image */}
57+
<div
58+
className="relative w-24 h-24 border-2 border-neutral-800/20 rounded-sm overflow-hidden"
59+
style={{
60+
transform: `rotate(${stampRotation}deg)`,
61+
boxShadow: '1px 1px 3px rgba(0,0,0,0.1)',
62+
}}
63+
>
64+
<Image
65+
src={blog.bannerId}
66+
alt={blog.bannerDescription}
67+
title={blog.bannerDescription}
68+
fill={true}
69+
className="object-cover grayscale opacity-90"
70+
placeholder="blur"
71+
blurDataURL={blog.bannerId}
72+
/>
73+
</div>
4474
</div>
45-
</figcaption>
46-
</NextLink>
47-
</figure>
75+
</div>
76+
</div>
77+
</NextLink>
4878
);
4979
};

src/modules/blog/BlogSuggestionsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const BlogSuggestionsList = ({blogs}: Props) => {
2323
{t('blogs')}
2424
</NextLink>
2525
</h2>
26-
<div className="grid-cols-1 w-screen px-6 mb-0 grid md:grid-cols-2 md:max-w-4xl gap-8 ">
26+
<div className="grid-cols-1 w-screen px-8 mb-0 grid md:grid-cols-2 md:max-w-4xl gap-8 ">
2727
{blogs.map(blog => (
2828
<BlogCardPreview blog={blog} key={blog.slug} />
2929
))}

0 commit comments

Comments
 (0)