85 lines
2.2 KiB
Plaintext
85 lines
2.2 KiB
Plaintext
---
|
|
import path from "node:path";
|
|
import type { Marketplace } from "../data/models/multis/Marketplace";
|
|
import { getAssetById } from "../data/api-client";
|
|
|
|
interface Props {
|
|
editToken?: string,
|
|
marketplace: Marketplace,
|
|
locale: string,
|
|
}
|
|
|
|
const { editToken, marketplace, locale } = Astro.props;
|
|
|
|
let marketplaceLogoImageAsset = await getAssetById(marketplace.logoImage[locale][0]);
|
|
let marketplaceLogoImage = path.posix.join('/img',
|
|
marketplaceLogoImageAsset.links['content']
|
|
.href
|
|
.split('/')
|
|
.reverse()
|
|
.filter((_value, index, array) => index < (array.length - index - 2))
|
|
.reverse()
|
|
.join('/'));
|
|
---
|
|
|
|
<li class="marketplace-card" data-squidex-token={editToken}>
|
|
<a href={`/${marketplace.slug[locale]}/`}>
|
|
{ marketplaceLogoImageAsset.metadata['background-color']
|
|
?
|
|
<img
|
|
src={marketplaceLogoImage}
|
|
alt={marketplace.marketplaceName[locale]}
|
|
title={marketplace.marketplaceName[locale]}
|
|
style={`background-color: ${marketplaceLogoImageAsset.metadata['background-color']}`}
|
|
/>
|
|
:
|
|
<img src={marketplaceLogoImage} alt={marketplace.marketplaceName[locale]} title={marketplace.marketplaceName[locale]} />
|
|
}
|
|
</a>
|
|
</li>
|
|
<style>
|
|
.marketplace-card {
|
|
list-style: none;
|
|
display: flex;
|
|
padding: 1px;
|
|
background-color: #23262d;
|
|
background-image: none;
|
|
background-size: 400%;
|
|
border-radius: 7px;
|
|
background-position: 100%;
|
|
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
|
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
|
|
text-align: center;
|
|
max-width: 12em;
|
|
}
|
|
.marketplace-card > a {
|
|
width: 100%;
|
|
text-decoration: none;
|
|
line-height: 1.4;
|
|
padding: calc(0.5rem - 1px);
|
|
border-radius: 8px;
|
|
color: white;
|
|
background-color: #23262d;
|
|
opacity: 0.8;
|
|
}
|
|
.marketplace-card img {
|
|
max-width: 100%;
|
|
}
|
|
.marketplace-card h2 {
|
|
margin: 0;
|
|
font-size: 1.25rem;
|
|
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
|
}
|
|
.marketplace-card p {
|
|
margin-top: 0.5rem;
|
|
margin-bottom: 0;
|
|
}
|
|
.marketplace-card:is(:hover, :focus-within) {
|
|
background-position: 0;
|
|
background-image: var(--accent-gradient);
|
|
}
|
|
.marketplace-card:is(:hover, :focus-within) h2 {
|
|
color: rgb(var(--accent-light));
|
|
}
|
|
</style>
|