-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathExamples.njs
More file actions
58 lines (53 loc) · 1.5 KB
/
Examples.njs
File metadata and controls
58 lines (53 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import Translatable from "./Translatable";
class Examples extends Translatable {
prepare({ page }) {
page.priority = 0.3;
}
renderProject({ title, repository }) {
return (
<a
href={repository}
target={repository.indexOf("http") === 0 && "_blank"}
rel="noopener"
class="block text-pink-600 dark:text-pink-500 border-t border-gray-100 dark:border-gray-800 py-2 mt-2"
>
{title}
</a>
);
}
renderPostExample({ title, href, description }) {
return (
<a href={href} class="w-full block mb-8">
<h2 class="w-full text-md sm:text-xl font-light mb-2 text-pink-600">
{title}
</h2>
<p class="text-base" title={description}>
{description}
</p>
</a>
);
}
render() {
if (!this.i18n) return false;
return (
<section class="max-w-screen-lg mx-auto px-4 flex justify-between items-center flex-wrap py-12 sm:py-24">
<h1 class="w-full text-pink-600 text-4xl sm:text-6xl font-light block sm:mb-3">
{this.i18n.heading}
</h1>
<p class="text-xl sm:text-2xl font-light block mb-3">
{this.i18n.tagline}
</p>
<p
class="w-full prose dark:prose-dark max-w-none text-xl"
html={this.i18n.contribute}
/>
<div class="w-full mt-8">
{this.i18n.posts?.map((post) => (
<PostExample {...post} />
))}
</div>
</section>
);
}
}
export default Examples;