Skip to content

Commit 348ee4b

Browse files
authored
feat(landing): improve feature card (#17)
1 parent 1a380f5 commit 348ee4b

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

‎app/components/landing/LandingFeatureCard.vue‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
<script setup lang="ts">
2-
defineProps<{
2+
const props = defineProps<{
33
icon?: string
44
to?: string
5+
color?: string
56
}>()
7+
8+
const rootClass = computed(() => props.color
9+
? 'landing-feature-card group transition duration-200 hover:bg-default hover:ring-(--feature-ring) hover:shadow-[0_12px_32px_-20px_var(--feature-glow)]'
10+
: 'group')
11+
12+
const iconClass = computed(() => props.color
13+
? 'mb-2 size-8 text-(--feature-color) grayscale opacity-60 transition duration-200 group-hover:grayscale-0 group-hover:opacity-100'
14+
: 'mb-2 size-8 text-primary')
615
</script>
716

817
<template>
918
<UPageCard
1019
:icon="icon"
1120
:to="to"
21+
:class="rootClass"
1222
:ui="{
13-
leadingIcon: 'mb-2 size-4 text-primary',
23+
leadingIcon: iconClass,
1424
title: 'text-sm font-medium tracking-tight text-highlighted',
1525
description: 'mt-1 text-sm leading-relaxed sm:line-clamp-2 lg:line-clamp-3 text-toned',
1626
}"
@@ -36,3 +46,26 @@ defineProps<{
3646
</template>
3747
</UPageCard>
3848
</template>
49+
50+
<style scoped>
51+
.landing-feature-card {
52+
--feature-color: v-bind(color);
53+
--feature-ring: color-mix(in oklab, var(--feature-color) 50%, var(--ui-border));
54+
--feature-glow: color-mix(in oklab, var(--feature-color) 40%, transparent);
55+
}
56+
57+
.landing-feature-card::before {
58+
content: '';
59+
position: absolute;
60+
inset: 0;
61+
border-radius: inherit;
62+
pointer-events: none;
63+
opacity: 0;
64+
transition: opacity 200ms;
65+
background: radial-gradient(140% 110% at 50% 0%, color-mix(in oklab, var(--feature-color) 9%, transparent) 0%, transparent 60%);
66+
}
67+
68+
.landing-feature-card:hover::before {
69+
opacity: 1;
70+
}
71+
</style>

0 commit comments

Comments
 (0)