AstroCol/src/components/ItemCard.astro

96 lines
2.2 KiB
Plaintext

---
import { getHighestWeightedLanguage, getLocales, getName } from '../lib/utils/langDriver';
interface Props {
id: string;
level: string;
name: string;
description: string;
image: string;
button_type: string;
button_name: string;
}
const lang = await getLocales(Astro.cookies.get('language')?.value ?? await getHighestWeightedLanguage(Astro.request.headers.get('accept-language')));
---
<div class="item-card" data-id={Astro.props.id}>
<img class="item-card-image" src={Astro.props.image} />
<div class="item-card-main-field">
<div class="item-card-name">{Astro.props.name} | {Astro.props.level}</div>
<div class="item-card-description">{Astro.props.description}</div>
<form method="post"><input type="hidden" name="id" value={Astro.props.id} /><input type="submit" class="item-card-build" value={getName(lang, Astro.props.button_type, Astro.props.button_name)} /></form>
<div class="item-card-info-button">i</div>
</div>
</div>
<style>
.item-card {
background-color: #fff;
color: #333;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
overflow: hidden;
position: relative;
width: 100%;
display: flex;
flex-direction: row;
width: 49%;
}
.item-card-expanded {
height: auto;
}
.item-card-image {
width: 150px;
height: 150px;
margin: 4px;
border-radius: 8px;
object-fit: cover;
}
.item-card-main-field {
background-color: #ccc;
width: 100%;
margin: 4px;
border-radius: 8px;
padding-left: 8px;
padding-right: 100px;
}
.item-card-name {
font-size: 48px;
}
.item-card-description {
font-size: 24px;
margin-top: 16px;
margin-bottom: 16px;
}
.item-card-build {
background-color: #333;
color: #fff;
border-radius: 8px;
padding: 8px 16px;
display: inline-block;
margin-top: 16px;
position: absolute;
bottom: 16px;
right: 16px;
}
.item-card-info-button {
background-color: #333;
color: #fff;
border-radius: 50%;
width: 32px;
height: 32px;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 16px;
right: 16px;
cursor: pointer;
}
</style>