Files
website-astro-stefanimhoff.de/src/pages/ai-art.astro
2023-07-01 13:52:28 +02:00

85 lines
2.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
import cx from 'classnames';
import { getCollection } from 'astro:content';
import { sortBySortKey } from '../utils';
import { animation } from '../data/site';
import GridLayout from '../layouts/GridLayout.astro';
import PageTitle from '../components/PageTitle.astro';
import Picture from '../components/Picture.astro';
import { Link } from '../components';
import { Content as Intro } from '../text/ai-art/intro.mdx';
import { mapping } from '../mdx-components';
const allAiArt = await getCollection('ai-art');
allAiArt.sort(sortBySortKey);
const title = 'AI Art';
const description = 'This is a collection of AI art pieces Ive created with Stable Diffusion.';
---
<GridLayout title={title} description={description} grid="wide" backLink="/" class="grid" innerGrid>
<PageTitle grid="wide" innerGrid>AI Art</PageTitle>
<article
class="col-start-1 col-end-18 grid md:col-start-4 md:col-end-12 xl:col-start-5 xl:col-end-11"
{...animation}
>
<Intro components={mapping} />
</article>
<nav
aria-label="AI Art"
class="col-start-1 col-end-18 md:col-start-1 md:col-end-16"
data-pagefind-ignore
>
<ol
class="gap-[max(25px,_2vw)] md:grid md:grid-flow-row-dense md:auto-rows-[50px] md:grid-cols-[repeat(auto-fit,_minmax(50px,_1fr))] md:grid-rows-[50px]"
>
{
allAiArt.map(({ slug, data }) => (
<li
class={cx({
'md:col-span-3 md:row-span-2':
data.images[0].aspectRatio > 1 && data.coverSize === 'small',
'md:col-span-2 md:row-span-3':
data.images[0].aspectRatio < 1 && data.coverSize === 'small',
'md:col-span-3 md:row-span-3':
data.images[0].aspectRatio === 1 && data.coverSize === 'small',
'md:col-span-4 md:row-span-3':
data.images[0].aspectRatio > 1 && data.coverSize === 'medium',
'md:col-span-3 md:row-span-4':
data.images[0].aspectRatio < 1 && data.coverSize === 'medium',
'md:col-span-4 md:row-span-4':
data.images[0].aspectRatio === 1 && data.coverSize === 'medium',
'md:col-span-6 md:row-span-5':
data.images[0].aspectRatio > 1 && data.coverSize === 'large',
'md:col-span-5 md:row-span-6':
data.images[0].aspectRatio < 1 && data.coverSize === 'large',
'md:col-span-6 md:row-span-6':
data.images[0].aspectRatio === 1 && data.coverSize === 'large',
})}
{...animation}
>
<Link title={data.title} href={`/ai-art/${slug}/`}>
<Picture
alt={data.title}
aspect={data.images[0].aspectRatio}
breakpoints={[500, 1000, 1500]}
class="h-full mbe-10 md:w-full md:object-cover md:!mbe-0 [&_img]:!block [&_img]:!h-full [&_img]:border-solid [&_picture]:!block [&_picture]:!h-full"
format={['avif']}
loading="eager"
src={data.images[0].src}
/>
</Link>
</li>
))
}
</ol>
</nav>
</GridLayout>