-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathContributors.njs
More file actions
133 lines (117 loc) · 3.92 KB
/
Contributors.njs
File metadata and controls
133 lines (117 loc) · 3.92 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import Translatable from './Translatable';
class Contributors extends Translatable {
documentation = [];
packages = [];
async fetchContributors({ repository }) {
const response = await fetch(`https://api.github.com/repos/nullstack/${repository}/contributors`);
return await response.json();
}
async hydrate() {
this.documentation = await this.fetchContributors({ repository: 'nullstack.github.io' });
const nullstack = await this.fetchContributors({ repository: 'nullstack' });
const createNulstackApp = await this.fetchContributors({ repository: 'create-nullstack-app' });
const createNulstaticApp = await this.fetchContributors({ repository: 'create-nullstatic-app' });
const packages = [...nullstack, ...createNulstackApp, ...createNulstaticApp];
const logins = new Set(packages.map(({ login }) => login));
this.packages = [...logins].map((login) => packages.find((contributor) => contributor.login == login));
}
renderTopic({ title, paragraphs, main, children }) {
return (
<div class="w-full mb-12">
<element tag={main ? 'h1' : 'h2'} class="text-xl sm:text-4xl font-light mb-4">
{title}
</element>
{paragraphs &&
<div class="text-xl">
{paragraphs.map((paragraph) => <p class="w-full mb-1" html={paragraph} />)}
</div>
}
<div class="xl x12">
{children}
</div>
</div>
)
}
renderState() {
const { state } = this.i18n;
return (
<Topic {...state} main />
)
}
renderRoadmap() {
const { roadmap } = this.i18n;
return (
<Topic {...roadmap} />
)
}
renderMainContributor({ github, name, role, description, contribution, work }) {
return (
<div class="border border-gray-100 dark:border-gray-800 p-2 mt-2 flex flex-wrap">
<img src={`https://github.com/${github}.png`} alt={name} width="128" height="128" class="w-32 h-32 mb-2 sm:mb-0" />
<div class="w-full sm:w-10/12 sm:pl-3">
<h3>
<a href={`https://github.com/${github}`} target="_blank" rel="noopener" class="text-pink-600">{name}</a>
</h3>
<h4 html={role} />
<p> {description} </p>
<p html={contribution} />
{work && <p class="font-semibold" html={work} />}
</div>
</div>
)
}
renderCoreTeam() {
const { core } = this.i18n;
return (
<Topic {...core}>
{core.team.map((contributor) => <MainContributor {...contributor} />)}
</Topic>
)
}
renderContentCreators() {
const { contentCreators } = this.i18n;
return (
<Topic {...contentCreators}>
{contentCreators.team.map((contributor) => <MainContributor {...contributor} />)}
</Topic>
)
}
renderInstructions() {
const { instructions } = this.i18n;
return (
<Topic {...instructions} />
)
}
renderContributor({ login, avatar_url, html_url }) {
return (
<a href={html_url} title={login} target="_blank" rel="noopener" class="ci1">
<img src={avatar_url} alt={login} width="90" height="90" class="h-24 w-24" />
</a>
)
}
renderGithubContributors({ title, key }) {
return (
<Topic title={title}>
<div class="flex justify-start flex-wrap">
{this[key].map((contributor) => <Contributor {...contributor} />)}
</div>
<p class="w-full mt-2">{this.i18n.githubCacheWarning}</p>
</Topic>
)
}
render() {
if (!this.i18n) return false;
return (
<section class="max-w-screen-xl mx-auto px-4 flex justify-between items-center flex-wrap py-12 sm:py-24">
<State />
<Roadmap />
<CoreTeam />
<ContentCreators />
<GithubContributors title={this.i18n.packages.title} key="packages" />
<GithubContributors title={this.i18n.documentation.title} key="documentation" />
<Instructions />
</section>
)
}
}
export default Contributors;