Skip to content

Commit 93865d6

Browse files
committed
Add ML Widget
1 parent e4298f2 commit 93865d6

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

Diff for: components/MLWidget.tsx

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import Image from 'next/image';
2+
import { ArrowRight } from 'react-feather';
3+
4+
import { Button } from './Button';
5+
6+
interface BgImage {
7+
url: string;
8+
description: string;
9+
blurDataURL: string;
10+
}
11+
12+
interface Props {
13+
bgImage: BgImage;
14+
}
15+
16+
export function MLWidget({ bgImage }: Props) {
17+
return (
18+
<section id="makers-league" className="relative rounded-3xl bg-[#E5F0F2]">
19+
<div className="aspect-w-3 aspect-h-2 overflow-hidden rounded-3xl sm:aspect-w-2 sm:aspect-h-1">
20+
<div className="hidden sm:block">
21+
<Image
22+
src={bgImage.url}
23+
layout={'fill'}
24+
objectFit="cover"
25+
objectPosition="center"
26+
sizes="90vw"
27+
quality={90}
28+
alt={bgImage.description}
29+
className="rounded-3xl"
30+
blurDataURL={bgImage.blurDataURL}
31+
placeholder="blur"
32+
/>
33+
</div>
34+
</div>
35+
<div className="absolute top-0 left-0 flex h-full w-full flex-col justify-end rounded-3xl px-6 py-12 text-dark xl:px-12 xl:py-20">
36+
<div>
37+
<h2 className="mb-1 text-2xl font-bold sm:text-3xl md:mb-2 md:text-4xl lg:text-5xl">
38+
Makers League e. V.
39+
</h2>
40+
<p className="mb-2 text-sm sm:text-base md:mb-4 md:text-lg lg:text-xl xl:text-2xl">
41+
Die Gemeinschaft für Macher*innen in Esslingen
42+
</p>
43+
<Button
44+
as="a"
45+
variant="link"
46+
href="https://makersleague.de"
47+
target="_blank"
48+
rel="noopener"
49+
>
50+
<ArrowRight />
51+
Zum Projekt
52+
</Button>
53+
</div>
54+
</div>
55+
</section>
56+
);
57+
}

Diff for: pages/index.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { BlogWidget } from '../components/BlogWidget';
77
import { ContactWidget } from '../components/ContactWidget';
88
import { Layout } from '../components/Layout';
99
import { LCDWidget } from '../components/LCDWidget';
10+
import { MLWidget } from '../components/MLWidget';
1011
import { NowPlaying } from '../components/NowPlaying';
1112
import { PodcastsWidget } from '../components/PodcastsWidget';
1213
import { RunningWidget } from '../components/RunningWidget';
@@ -51,6 +52,11 @@ interface Props {
5152
description: string;
5253
blurDataURL: string;
5354
};
55+
MLImage: {
56+
url: string;
57+
description: string;
58+
blurDataURL: string;
59+
};
5460
contact: string;
5561
}
5662

@@ -76,6 +82,7 @@ const Home: NextPage<Props> = function (props) {
7682
<RunningWidget />
7783
<PodcastsWidget podcasts={props.favoritePodcasts} />
7884
<Web3Widget />
85+
<MLWidget bgImage={props.MLImage} />
7986
<NowPlaying />
8087
<ContactWidget text={props.contact} />
8188
</Layout>
@@ -138,6 +145,12 @@ export const getStaticProps: GetStaticProps = async ({ preview = false }) => {
138145
description
139146
}
140147
}
148+
MLImage: assetCollection(where: {title: "Makersleague.de"}, limit: 1, preview: false) {
149+
items {
150+
url
151+
description
152+
}
153+
}
141154
}`,
142155
preview
143156
);
@@ -163,6 +176,11 @@ export const getStaticProps: GetStaticProps = async ({ preview = false }) => {
163176
size: 10,
164177
});
165178
LCDImage.blurDataURL = LCDImageBase64;
179+
const MLImage = response.data.MLImage.items[0];
180+
const { base64: MLImageBase64 } = await getPlaiceholder(MLImage.url, {
181+
size: 10,
182+
});
183+
MLImage.blurDataURL = MLImageBase64;
166184

167185
let aboutTeaser = person.cvText;
168186
aboutTeaser = stripFirstLine(aboutTeaser);
@@ -190,6 +208,7 @@ export const getStaticProps: GetStaticProps = async ({ preview = false }) => {
190208
smartHomeFootnote: await markdownToHTML(smartHomeFootnoteText),
191209
favoritePodcasts,
192210
LCDImage,
211+
MLImage,
193212
contact: await markdownToHTML(contactText),
194213
},
195214
};

0 commit comments

Comments
 (0)