Skip to content

Commit ffb40e8

Browse files
RDoc-3711 Fix DOM syntax for Cards
1 parent 34860f9 commit ffb40e8

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

src/components/Common/CardWithImage.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ export default function CardWithImage({
4242
});
4343

4444
return (
45-
<Link to={url} className="card-wrapper">
45+
<article className="card-wrapper group">
46+
<Link to={url} className={clsx("absolute inset-0 z-1", "!transition-all")} />
4647
<div
4748
className={clsx(
48-
"card group flex h-full flex-col",
49+
"card flex h-full flex-col",
4950
"p-4 overflow-hidden rounded-2xl",
5051
"border border-black/10 dark:border-white/10",
51-
"!bg-black/5 dark:!bg-white/5 text-inherit hover:no-underline",
52-
"hover:border-black/20 dark:hover:border-white/20",
53-
"hover:!bg-black/10 dark:hover:!bg-white/10",
52+
"!bg-black/5 dark:!bg-white/5 text-inherit group-hover:no-underline",
53+
"group-hover:border-black/20 dark:group-hover:border-white/20",
54+
"group-hover:!bg-black/10 dark:group-hover:!bg-white/10",
5455
"!transition-all",
5556
"animate-in fade-in slide-in-from-bottom-4"
5657
)}
@@ -99,7 +100,7 @@ export default function CardWithImage({
99100
</div>
100101
<p className="!mb-0 text-sm pt-2">{description}</p>
101102
{(hasTags || hasDate) && (
102-
<div className="flex flex-wrap justify-between pt-2 gap-3">
103+
<div className="flex flex-wrap justify-between pt-2 gap-3 z-2">
103104
{hasTags && (
104105
<div className="flex gap-1 items-center flex-wrap">
105106
{visibleTags.map((tag) => (
@@ -126,6 +127,6 @@ export default function CardWithImage({
126127
</div>
127128
)}
128129
</div>
129-
</Link>
130+
</article>
130131
);
131132
}

src/components/Common/GuideListItem.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,31 @@ export default function GuideListItem({ title, url, tags = [], date }: GuideList
1818
});
1919

2020
return (
21-
<Link
22-
to={url}
21+
<article
2322
className={clsx(
2423
"flex flex-col-reverse py-3 px-2 gap-1",
2524
"border-b border-black/10 dark:border-white/10 !text-inherit",
2625
"hover:!no-underline",
2726
"group relative",
28-
"!transition-all",
29-
"hover:bg-black/5 dark:hover:bg-white/5",
3027
"sm:flex-row sm:items-center sm:gap-4"
3128
)}
3229
>
30+
<Link
31+
to={url}
32+
className={clsx(
33+
"absolute inset-0 z-1",
34+
"!transition-all",
35+
"group-hover:bg-black/5 dark:group-hover:bg-white/5"
36+
)}
37+
/>
3338
<div
3439
className={clsx(
3540
"flex flex-col flex-1 flex-wrap justify-between min-w-0 gap-1",
3641
"lg:flex-row lg:items-center lg:flex-nowrap"
3742
)}
3843
>
3944
<p className={clsx("!mb-0 font-semibold leading-5", "sm:shrink")}>{title}</p>
40-
<div className={clsx("flex gap-1 items-center flex-wrap whitespace-normal", "sm:shrink-0")}>
45+
<div className={clsx("flex gap-1 items-center flex-wrap whitespace-normal z-2", "sm:shrink-0")}>
4146
{visibleTags.map((tag) => (
4247
<Tag key={tag.label} size="xs" permalink={tag.permalink}>
4348
{tag.label}
@@ -70,6 +75,6 @@ export default function GuideListItem({ title, url, tags = [], date }: GuideList
7075
{date}
7176
</p>
7277
)}
73-
</Link>
78+
</article>
7479
);
7580
}

src/css/custom.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ code {
405405

406406
/* Custom display for card wrapper */
407407
.card-wrapper {
408-
@apply flex !no-underline !text-inherit hover:!no-underline;
408+
@apply flex !no-underline !text-inherit hover:!no-underline relative;
409409
}
410410

411411
.card {
@@ -623,7 +623,7 @@ a {
623623

624624
/* The track (progress bar) of the scrollbar */
625625
::-webkit-scrollbar-track {
626-
background-color: inherit;
626+
background-color: transparent;
627627
}
628628

629629
/* The entire scrollbar */

src/theme/Tag/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function Tag({
2525
const isXs = size === "xs";
2626

2727
const baseClasses = clsx(
28-
"inline-flex items-center select-none border",
28+
"inline-flex items-center select-none border cursor-pointer",
2929
"bg-black/5 dark:bg-white/5 border-black/10 dark:border-white/10",
3030
"hover:bg-black/10 dark:hover:bg-white/10 hover:!no-underline",
3131
isXs

0 commit comments

Comments
 (0)