refactor: ♻️ migrate character card to css grid

This commit is contained in:
Sebin Nyshkim 2025-04-09 19:13:07 +02:00
parent 6e954e4099
commit b91e9f609a

View file

@ -1,31 +1,36 @@
<a class="character-card" :href="href" :class="char"> <a class="character-card" :href="href" :class="char">
<div class="image">
<slot name="image"></slot> <slot name="image"></slot>
<section class="text"> </div>
<div class="text">
<slot name="title"></slot> <slot name="title"></slot>
<slot></slot> <slot></slot>
</section> </div>
</a> </a>
<style> <style>
.character-card { .character-card {
background-color: var(--clr-box-background); display: grid;
border: var(--border-thin) solid var(--clr-box-border); align-content: start;
font-size: 0.875em;
border-radius: 1em;
overflow: hidden;
font-size: 0.875em;
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
background-color: var(--clr-box-background);
border: var(--border-thin) solid var(--clr-box-border);
border-radius: 1em;
overflow: hidden;
&:hover { &:hover {
img { img {
transform: scale(1.1); scale: 1.1;
} }
} }
& picture { & .image {
display: flex;
align-items: center;
overflow: hidden; overflow: hidden;
aspect-ratio: 3/2; aspect-ratio: 3/2;
} }
@ -34,8 +39,8 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
transform: scale(1); scale: 1;
transition: transform 0.2s ease-in-out; transition: scale 0.2s ease-in-out;
} }
& .text { & .text {
@ -45,11 +50,10 @@
} }
& h2 { & h2 {
--heading-spacing: 0.5em;
position: relative; position: relative;
font-size: 1.375rem; font-size: 1.375rem;
margin-block: 0 var(--heading-spacing); margin-block: 0 0.5em;
padding-block: 0 var(--heading-spacing); padding-block: 0 0.5em;
&::after { &::after {
content: ''; content: '';