2023-01-21 00:43:00 +01:00
|
|
|
---
|
2023-12-25 18:39:44 +01:00
|
|
|
import { Image } from 'astro:assets'
|
2024-07-19 22:52:15 +02:00
|
|
|
import type { GlobImage } from '../../types/generic'
|
|
|
|
import { plsLoadImage } from '../../utils/tools'
|
2024-01-05 01:12:19 +01:00
|
|
|
|
2023-01-21 00:43:00 +01:00
|
|
|
export interface Props {
|
2023-03-10 20:10:54 +01:00
|
|
|
date: string
|
2023-03-09 11:44:18 +01:00
|
|
|
title: string
|
|
|
|
link: string
|
2023-12-25 18:39:44 +01:00
|
|
|
targetImageFile: string
|
2023-03-11 19:59:51 +01:00
|
|
|
user?: string
|
2023-12-25 18:39:44 +01:00
|
|
|
servantImageFile?: string
|
2023-03-16 17:25:45 +01:00
|
|
|
turns?: string
|
2023-01-21 00:43:00 +01:00
|
|
|
}
|
|
|
|
|
2023-12-25 18:39:44 +01:00
|
|
|
const { turns, targetImageFile, user, date, servantImageFile, link, title } =
|
|
|
|
Astro.props
|
2023-01-21 00:43:00 +01:00
|
|
|
|
2023-03-10 20:10:54 +01:00
|
|
|
const options_date: Intl.DateTimeFormatOptions = {
|
|
|
|
year: 'numeric',
|
|
|
|
month: '2-digit',
|
|
|
|
day: '2-digit',
|
|
|
|
}
|
|
|
|
|
2023-12-25 18:39:44 +01:00
|
|
|
const targetImagePath = `/src/assets/ta_icons/${targetImageFile}`
|
|
|
|
const servantImagePath = `/src/assets/ta_icons/ta_servants/${servantImageFile}`
|
|
|
|
|
2023-03-10 20:10:54 +01:00
|
|
|
const formatted_date = new Date(date).toLocaleDateString('de-DE', options_date)
|
2024-01-05 01:12:19 +01:00
|
|
|
const target_images = import.meta.glob<GlobImage>(
|
2023-12-25 23:49:11 +01:00
|
|
|
'/src/assets/ta_icons/*.{png,webp}'
|
2023-12-25 18:39:44 +01:00
|
|
|
)
|
2024-01-05 01:12:19 +01:00
|
|
|
const servant_images = import.meta.glob<GlobImage>(
|
2023-12-25 23:49:11 +01:00
|
|
|
'/src/assets/ta_icons/ta_servants/*.{png,webp}'
|
2023-12-25 18:39:44 +01:00
|
|
|
)
|
2023-03-11 19:59:51 +01:00
|
|
|
|
2024-01-05 01:12:19 +01:00
|
|
|
const loadedServantImage = plsLoadImage(servant_images, servantImagePath)
|
|
|
|
const loadedTargetImage = plsLoadImage(target_images, targetImagePath)
|
|
|
|
|
2024-10-23 17:28:06 +02:00
|
|
|
const hasuser = user !== undefined ? 'display: flex' : 'display: none'
|
2023-01-21 00:43:00 +01:00
|
|
|
---
|
2023-03-09 11:44:18 +01:00
|
|
|
|
2023-01-27 11:16:01 +01:00
|
|
|
<a href={link} target="_blank" rel="noopener noreferrer" aria-label={title}>
|
2024-10-23 17:28:06 +02:00
|
|
|
<div class="imagecontainer">
|
|
|
|
<Image src={loadedTargetImage} alt={title} />
|
2023-12-25 18:39:44 +01:00
|
|
|
<div class="title">
|
|
|
|
<h2>{title}</h2>
|
2023-03-09 11:44:18 +01:00
|
|
|
</div>
|
2024-10-23 17:28:06 +02:00
|
|
|
</div>
|
|
|
|
<p>
|
|
|
|
<span style={hasuser}>By {user}<br />•</span>
|
|
|
|
{formatted_date}
|
|
|
|
</p>
|
|
|
|
<div class="expand-on-hover">
|
|
|
|
<Image src={loadedServantImage} alt="" />
|
|
|
|
<h2>{turns}</h2>
|
|
|
|
</div>
|
2023-01-21 00:43:00 +01:00
|
|
|
</a>
|
|
|
|
|
|
|
|
<style>
|
2024-10-29 22:17:38 +01:00
|
|
|
* {
|
|
|
|
transition: all var(--a-time-default) var(--a-animation-1);
|
|
|
|
}
|
2023-03-10 20:10:54 +01:00
|
|
|
a {
|
|
|
|
text-decoration: none;
|
2024-10-23 17:28:06 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-wrap: wrap;
|
2024-10-24 18:52:33 +02:00
|
|
|
background-color: var(--c-primary-background);
|
|
|
|
border: 2px var(--c-primary-background) solid;
|
2023-01-21 00:43:00 +01:00
|
|
|
padding: 10px;
|
|
|
|
text-align: center;
|
2024-10-23 17:28:06 +02:00
|
|
|
width: max(30%, 100px);
|
2023-01-21 00:43:00 +01:00
|
|
|
height: auto;
|
2023-07-08 14:38:36 +02:00
|
|
|
border-radius: 1.25rem;
|
2023-12-25 18:39:44 +01:00
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2024-10-23 17:28:06 +02:00
|
|
|
z-index: 1;
|
2023-03-09 11:44:18 +01:00
|
|
|
}
|
2023-12-25 18:39:44 +01:00
|
|
|
|
2024-10-23 17:28:06 +02:00
|
|
|
a:hover {
|
2024-10-21 22:23:25 +02:00
|
|
|
transform: scale(1);
|
2024-10-24 18:52:33 +02:00
|
|
|
border-color: var(--c-accent-1);
|
2024-10-23 17:28:06 +02:00
|
|
|
z-index: 10;
|
2023-03-09 11:44:18 +01:00
|
|
|
}
|
2023-12-25 18:39:44 +01:00
|
|
|
|
2024-10-23 17:28:06 +02:00
|
|
|
.imagecontainer {
|
|
|
|
display: flex;
|
|
|
|
width: 90%;
|
|
|
|
height: auto;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
.imagecontainer > img {
|
|
|
|
width: 100%;
|
|
|
|
height: auto;
|
2023-07-08 14:38:36 +02:00
|
|
|
border-radius: 1.25rem;
|
2023-03-09 11:44:18 +01:00
|
|
|
}
|
2023-01-21 00:43:00 +01:00
|
|
|
|
2024-10-23 17:28:06 +02:00
|
|
|
a:hover .title {
|
2023-03-15 17:03:50 +01:00
|
|
|
display: flex;
|
2023-07-08 14:38:36 +02:00
|
|
|
position: absolute;
|
2023-03-15 17:03:50 +01:00
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
text-align: center;
|
2024-10-24 18:52:33 +02:00
|
|
|
background-color: var(--c-primary-background);
|
2024-10-23 17:28:06 +02:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2023-01-21 00:43:00 +01:00
|
|
|
opacity: 90%;
|
2024-10-24 18:52:33 +02:00
|
|
|
box-shadow: 0px 0px 0px 1px var(--c-primary-background);
|
2023-07-08 14:38:36 +02:00
|
|
|
border-radius: 1.25rem;
|
2023-03-09 11:44:18 +01:00
|
|
|
}
|
2023-01-21 00:43:00 +01:00
|
|
|
|
2024-10-23 17:28:06 +02:00
|
|
|
a:hover .title h2 {
|
|
|
|
margin: 4px;
|
2023-03-15 17:03:50 +01:00
|
|
|
display: inline-flex;
|
2024-10-23 17:28:06 +02:00
|
|
|
font-weight: 500;
|
2024-10-24 18:52:33 +02:00
|
|
|
color: var(--c-primary-text);
|
2024-10-23 17:28:06 +02:00
|
|
|
font-size: 1rem;
|
2023-03-15 17:03:50 +01:00
|
|
|
line-height: 150%;
|
|
|
|
}
|
|
|
|
|
2024-10-23 17:28:06 +02:00
|
|
|
a .title {
|
2023-03-15 17:03:50 +01:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2023-03-10 20:10:54 +01:00
|
|
|
p {
|
|
|
|
display: flex;
|
2024-10-23 17:28:06 +02:00
|
|
|
flex-wrap: wrap;
|
|
|
|
flex-direction: column;
|
2023-03-10 20:10:54 +01:00
|
|
|
text-align: center;
|
|
|
|
justify-content: center;
|
2023-03-11 19:59:51 +01:00
|
|
|
align-items: center;
|
2023-03-10 20:10:54 +01:00
|
|
|
line-height: 100%;
|
|
|
|
text-decoration: none;
|
2024-10-24 18:52:33 +02:00
|
|
|
color: var(--c-primary-text);
|
2023-03-10 20:10:54 +01:00
|
|
|
font-size: 1rem;
|
2024-10-23 17:28:06 +02:00
|
|
|
font-weight: 400;
|
2024-10-25 15:26:25 +02:00
|
|
|
margin: 0.5rem 0px 0.625rem 0px;
|
2023-03-10 20:10:54 +01:00
|
|
|
}
|
2023-03-16 17:25:45 +01:00
|
|
|
|
|
|
|
.expand-on-hover {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
flex-wrap: wrap;
|
2024-10-21 22:23:25 +02:00
|
|
|
align-items: top;
|
2023-03-16 17:25:45 +01:00
|
|
|
justify-content: space-evenly;
|
2024-10-24 18:52:33 +02:00
|
|
|
background-color: var(--c-primary-background);
|
2024-10-29 22:17:38 +01:00
|
|
|
border: 2px var(--c-primary-background) solid;
|
2024-10-21 22:23:25 +02:00
|
|
|
border-top: 0px;
|
2023-03-16 17:25:45 +01:00
|
|
|
z-index: 99;
|
|
|
|
transform: scaleY(0);
|
|
|
|
transform-origin: top;
|
|
|
|
position: absolute;
|
2024-10-25 15:26:25 +02:00
|
|
|
top: 87.5%;
|
2024-10-23 17:28:06 +02:00
|
|
|
padding-top: 0.5rem;
|
|
|
|
margin-top: 0.2rem;
|
2024-10-24 18:52:33 +02:00
|
|
|
color: var(--c-primary-text);
|
2023-07-08 14:38:36 +02:00
|
|
|
border-radius: 0px 0px 1.25rem 1.25rem;
|
2024-10-21 22:23:25 +02:00
|
|
|
width: 100%;
|
2023-03-16 17:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.expand-on-hover img {
|
2024-10-23 17:28:06 +02:00
|
|
|
width: 2.5rem;
|
|
|
|
height: auto;
|
2023-07-08 14:38:36 +02:00
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
border-radius: 0.5rem;
|
2023-03-16 17:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.expand-on-hover h2 {
|
|
|
|
margin: 0.5rem;
|
|
|
|
}
|
|
|
|
|
2024-10-23 17:28:06 +02:00
|
|
|
a:hover .expand-on-hover {
|
2023-03-16 17:25:45 +01:00
|
|
|
transform: scaleY(1);
|
2024-10-29 22:17:38 +01:00
|
|
|
transition: all var(--a-time-default) var(--a-animation-1);
|
2024-10-24 18:52:33 +02:00
|
|
|
background-color: var(--c-primary-background);
|
2024-10-29 22:17:38 +01:00
|
|
|
border-color: var(--c-accent-1);
|
2023-03-16 17:25:45 +01:00
|
|
|
}
|
2024-10-23 17:28:06 +02:00
|
|
|
|
|
|
|
@media (min-width: 512px) {
|
|
|
|
a {
|
|
|
|
padding: 10px;
|
|
|
|
width: auto;
|
|
|
|
height: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
a > .imagecontainer {
|
|
|
|
width: 112px;
|
|
|
|
height: 112px;
|
|
|
|
}
|
|
|
|
}
|
2023-03-09 11:44:18 +01:00
|
|
|
</style>
|