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

122 lines
2.5 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>
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 {
color: white;
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;
2023-03-09 11:44:18 +01:00
color: var(--c-darkpurple);
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;
2023-03-09 11:44:18 +01:00
color: white;
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;
2023-03-09 11:44:18 +01:00
background-color: var(--c-darkergray);
padding: 10px;
text-align: center;
transition: transform var(--speed) var(--ease);
min-height: 100%;
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
2023-03-15 11:08:19 +01:00
a:hover > article {
2023-03-15 13:06:45 +01:00
transform: scaleY(102.5%) scaleX(101%);
2024-07-19 22:52:15 +02:00
transition: transform var(--speed) var(--ease);
}
@media (min-width: 900px) {
.circle {
margin: 1rem 0.5rem 1rem 0.5rem;
position: relative;
display: flex;
visibility: visible;
height: 1rem;
width: 1rem;
background-color: var(--c-darkpurple);
border-style: solid;
border-width: 0.25rem;
border-color: var(--c-lightgray);
border-radius: 40%;
transition: transform var(--speed) var(--ease);
}
a:hover > .circle {
height: 1.25rem;
width: 1.25rem;
translate: -0.125rem;
margin-right: 4px;
}
a:hover article {
border-color: var(--c-darkpurple);
transform: none;
}
article {
border-style: solid;
border-width: 2px;
border-color: var(--c-darkergray);
align-items: flex-start;
align-content: flex-start;
margin-left: 0.5rem;
}
2023-03-09 11:44:18 +01:00
}
</style>