Skip to content

Commit fdea286

Browse files
authored
Merge pull request #1870 from hrx01-dev/fix/ClickabilityIssue-onlandingPage-in-Blog
Fixed clickability on the blogs listed on the landing page
2 parents 4b030b8 + 9c7fe38 commit fdea286

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/components/blogCarousel/blogCard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import React from "react";
33
import Link from "@docusaurus/Link";
44
import { getAuthorProfiles } from "../../utils/authors";
5-
import { usePluginData } from "@docusaurus/useGlobalData";
5+
66

77
interface BlogCardProps {
88
type: string;
99
date?: string;
1010
title: string;
11-
content: string;
1211
imageUrl: string;
1312
id: string;
1413
authors?: string[];
@@ -50,7 +49,6 @@ const BlogCard = ({
5049
type,
5150
date,
5251
title,
53-
content,
5452
imageUrl,
5553
id,
5654
authors,
@@ -80,7 +78,9 @@ const BlogCard = ({
8078
<div className="article-card">
8179
{/* Image */}
8280
<div className="card-image">
83-
<img src={imageUrl} alt={title} loading="lazy" />
81+
<Link to={`/blog/${id}`} className="block" aria-label={`Read ${title}`}>
82+
<img src={imageUrl} alt={title} loading="lazy" />
83+
</Link>
8484
</div>
8585

8686
{/* Content */}
@@ -202,4 +202,4 @@ const BlogCard = ({
202202
);
203203
};
204204

205-
export default BlogCard;
205+
export default BlogCard;

src/components/blogCarousel/blogCarousel.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@
102102
flex-shrink: 0;
103103
}
104104

105+
.card-image a {
106+
display: block;
107+
width: 100%;
108+
height: 100%;
109+
}
110+
105111
.card-image::after {
106112
content: "";
107113
position: absolute;
@@ -112,13 +118,15 @@
112118
opacity: 0;
113119
transition: opacity 0.35s ease;
114120
z-index: 1;
121+
pointer-events: none;
115122
}
116123

117124
.article-card:hover .card-image::after {
118125
opacity: 1;
119126
}
120127

121128
.card-image img {
129+
display: block;
122130
width: 100%;
123131
height: 100%;
124132
object-fit: cover;
@@ -157,6 +165,7 @@
157165
transition: color 0.2s ease;
158166
display: -webkit-box;
159167
-webkit-line-clamp: 2;
168+
line-clamp: 2;
160169
-webkit-box-orient: vertical;
161170
overflow: hidden;
162171
}
@@ -195,6 +204,7 @@
195204
margin: 0 0 16px 0;
196205
display: -webkit-box;
197206
-webkit-line-clamp: 3;
207+
line-clamp: 3;
198208
-webkit-box-orient: vertical;
199209
overflow: hidden;
200210
flex: 1;
@@ -635,6 +645,7 @@
635645
transform: translateY(-20px);
636646
transition: opacity 0.4s ease-in, transform 0.4s ease-in;
637647
}
648+
638649
/* ── Reading time ── */
639650
.card-reading-time {
640651
display: inline-flex;

0 commit comments

Comments
 (0)