Skip to content

Commit d617449

Browse files
KyleAMathewsclaude
andauthored
Fix list item styling (#3590)
The Card component was always wrapping content in an <a> tag even when no href was provided. This created invalid nested anchors when Card was used inside another link (e.g., in WorksWithSection integrations list), causing unpredictable click behavior where clicking on one item could navigate to a different href. Now Card only renders the <a> wrapper when href is actually provided. Co-authored-by: Claude <[email protected]>
1 parent 850ad3d commit d617449

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

website/src/components/home/Card.vue

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const { background, body, href, icon, image, title } = defineProps([
9494
</style>
9595

9696
<template>
97-
<a class="no-visual" :href="href">
97+
<a v-if="href" class="no-visual" :href="href">
9898
<div
9999
class="card"
100100
:style="{
@@ -123,4 +123,32 @@ const { background, body, href, icon, image, title } = defineProps([
123123
</slot>
124124
</div>
125125
</a>
126+
<div
127+
v-else
128+
class="card"
129+
:style="{
130+
backgroundColor: background ? background : 'var(--vp-c-bg-soft)',
131+
}"
132+
>
133+
<slot name="override_contents">
134+
<div v-if="image" class="image">
135+
<img :src="image" />
136+
</div>
137+
<div v-if="icon" class="icon">
138+
<img :src="icon" />
139+
</div>
140+
<div
141+
class="body"
142+
:style="{
143+
backgroundColor: background ? background : 'var(--vp-c-bg-soft)',
144+
}"
145+
>
146+
<h3 v-if="title">
147+
{{ title }}
148+
</h3>
149+
<p v-if="body" v-html="body"></p>
150+
<slot></slot>
151+
</div>
152+
</slot>
153+
</div>
126154
</template>

0 commit comments

Comments
 (0)