simon-einzinger.de/docs/.vitepress/theme/layout/BlogItem.vue
2025-01-24 19:05:29 +01:00

100 lines
1.8 KiB
Vue

<script setup lang="ts">
interface BlogItemProps {
url: string;
title: string;
date: string;
excerpt: string;
}
const props = defineProps<BlogItemProps>();
</script>
<template>
<div class="blog-card">
<div class="blog-header">
<h2 class="blog-title">
<a :href="props.url">
{{ props.title }}
</a>
</h2>
<span class="blog-date">{{ props.date }}</span>
</div>
<div v-if="props.excerpt" v-html="props.excerpt"></div>
</div>
</template>
<style scoped>
.blog-card {
position: relative;
margin-bottom: 1.5em;
padding: 1.5em;
border: 1px solid var(--outline-color);
border-radius: 8px;
background-color: transparent;
transition:
transform 0.3s,
box-shadow 0.3s,
opacity 0.3s;
}
.blog-card::before {
content: "";
position: absolute;
inset: 0;
border-radius: 8px;
background: linear-gradient(
45deg,
var(--primary-color),
var(--highlight-color)
);
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
opacity: 0;
transition: opacity 0.3s;
z-index: -1;
}
.blog-card:hover {
transform: translateY(-5px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.blog-card:hover::before {
opacity: 1;
}
.blog-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1em;
}
.blog-title {
margin: 0;
font-size: 1.2em;
color: var(--secondary-text-color);
font-weight: var(--font-weight-bold);
}
.blog-title a {
text-decoration: none;
color: inherit; /* Inherit the .blog-title color */
}
.blog-date {
font-size: 0.9em;
color: var(--text-color);
}
.blog-excerpt {
margin: 0;
margin-top: 0.5em;
color: var(--text-color);
font-weight: var(--font-weight-regular);
}
</style>