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

99 lines
1.9 KiB
Text
Raw Normal View History

2023-03-08 20:53:38 +01:00
---
export interface Props {
2023-03-09 11:44:18 +01:00
url: string | undefined
title: string
pubdate: string
description: 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
}
2023-03-09 11:44:18 +01:00
const { description, pubdate, url, title } = Astro.props
const date = new Date(pubdate).toLocaleDateString('en-GB', options_date)
2023-03-08 20:53:38 +01:00
---
<a href={url} 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>
<h3>{date}</h3>
<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;
}
@media (min-width: 900px) {
.circle {
margin: 1rem 1rem 1rem 0rem;
position: relative;
display: flex;
visibility: visible;
height: 1.5rem;
width: 1.5rem;
border-radius: 50%;
background-color: var(--c-darkpurple);
}
a:hover > .circle {
transform: none;
}
article {
margin-left: 0.5rem;
}
2023-03-15 00:58:54 +01:00
}
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;
height: auto;
margin: 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;
2023-03-14 20:34:51 +01:00
align-items: flex-start;
2023-03-09 11:44:18 +01:00
align-content: flex-start;
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-03-15 11:08:19 +01:00
a:hover > article {
2023-03-15 13:06:45 +01:00
transform: scaleY(102.5%) scaleX(101%);
2023-03-09 11:44:18 +01:00
}
</style>