firq-dev-website/src/components/cards/blogCard.astro

117 lines
2.4 KiB
Text
Raw Normal View History

2023-03-08 20:53:38 +01:00
---
export interface Props {
2024-07-19 22:52:15 +02:00
url: string
slug: string
2023-03-09 11:44:18 +01:00
title: string
2024-07-19 22:52:15 +02:00
pubdate: Date
2023-03-09 11:44:18 +01:00
description: string
2023-03-19 13:14:50 +01:00
author: string
2023-03-08 20:53:38 +01:00
}
const options_date: Intl.DateTimeFormatOptions = {
2023-03-09 11:44:18 +01:00
year: 'numeric',
month: 'long',
day: '2-digit',
2023-03-08 20:53:38 +01:00
}
2024-07-19 22:52:15 +02:00
const { author, description, pubdate, url, title, slug } = Astro.props
2023-03-09 11:44:18 +01:00
const date = new Date(pubdate).toLocaleDateString('en-GB', options_date)
2023-03-08 20:53:38 +01:00
---
2024-07-19 22:52:15 +02:00
<a href={`${url}/${slug}`} rel="noopener noreferrer">
2023-03-15 00:58:54 +01:00
<div class="circle"></div>
2023-03-09 11:44:18 +01:00
<article>
<h2>{title}</h2>
2023-03-19 13:14:50 +01:00
<h3>{date} • Written by {author}</h3>
2023-03-09 11:44:18 +01:00
<p>{description}</p>
</article>
2023-03-08 20:53:38 +01:00
</a>
<style>
2024-10-29 22:17:38 +01:00
* {
transition: all var(--a-time-default) var(--a-animation-1);
}
2023-03-15 00:58:54 +01:00
.circle {
display: none;
}
2023-03-09 11:44:18 +01:00
a {
2023-03-15 00:58:54 +01:00
align-items: center;
justify-content: center;
2023-03-14 20:34:51 +01:00
display: flex;
2023-03-09 11:44:18 +01:00
text-decoration: none;
2024-07-19 22:52:15 +02:00
height: fit-content;
margin: 0px 0.5rem;
2023-03-14 20:34:51 +01:00
width: 100%;
2023-03-09 11:44:18 +01:00
}
p {
2024-10-24 18:52:33 +02:00
color: var(--c-primary-text);
2023-03-09 11:44:18 +01:00
text-align: left;
font-size: 1.1em;
margin: 0.5em;
}
article > h2 {
2023-03-14 20:34:51 +01:00
margin: 0.3rem 0.5rem;
2024-10-24 18:52:33 +02:00
color: var(--c-accent-1);
2023-03-14 20:34:51 +01:00
font-size: 1.5rem;
2023-03-09 11:44:18 +01:00
line-height: normal;
text-decoration: none;
}
article > h3 {
2023-03-14 20:34:51 +01:00
margin: 0.2em 0.5rem;
2024-10-24 18:52:33 +02:00
color: var(--c-primary-text);
2023-03-14 20:34:51 +01:00
font-size: 1rem;
2023-03-09 11:44:18 +01:00
line-height: normal;
text-decoration: none;
}
article {
display: flex;
flex: 1;
flex-wrap: wrap;
flex-direction: column;
2024-07-19 22:52:15 +02:00
align-items: center;
align-content: center;
2023-03-14 20:34:51 +01:00
justify-content: center;
2024-10-24 18:52:33 +02:00
background-color: var(--c-primary-background);
2023-03-09 11:44:18 +01:00
padding: 10px;
text-align: center;
min-height: 100%;
2024-10-25 15:26:25 +02:00
border: 2px solid var(--c-primary-background);
2023-07-08 14:47:15 +02:00
border-radius: 1.25rem;
2023-03-09 11:44:18 +01:00
}
2024-07-19 22:52:15 +02:00
2024-10-25 15:26:25 +02:00
a:hover article {
border-color: var(--c-accent-1);
}
2024-07-19 22:52:15 +02:00
@media (min-width: 900px) {
.circle {
margin: 1rem 0.5rem 1rem 0.5rem;
position: relative;
display: flex;
visibility: visible;
height: 1rem;
width: 1rem;
2024-10-24 18:52:33 +02:00
background-color: var(--c-accent-1);
2024-07-19 22:52:15 +02:00
border-style: solid;
border-width: 0.25rem;
2024-10-24 18:52:33 +02:00
border-color: var(--c-secondary-background);
2024-07-19 22:52:15 +02:00
border-radius: 40%;
2024-10-24 18:52:33 +02:00
transition: all var(--a-time-short) var(--a-animation-1);
2024-07-19 22:52:15 +02:00
}
a:hover > .circle {
height: 1.25rem;
width: 1.25rem;
translate: -0.125rem;
margin-right: 4px;
}
article {
2024-10-25 15:26:25 +02:00
border: 2px solid var(--c-primary-background);
2024-07-19 22:52:15 +02:00
align-items: flex-start;
align-content: flex-start;
margin-left: 0.5rem;
}
2023-03-09 11:44:18 +01:00
}
</style>