Skip to content

Commit 9802fbe

Browse files
committed
docs: update contribute style
1 parent a0635cb commit 9802fbe

File tree

7 files changed

+73
-6
lines changed

7 files changed

+73
-6
lines changed

Diff for: docs/.vitepress/components/HomeContributors.vue

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script setup lang="ts">
2+
import { contributors } from '../../../scripts/contributors';
3+
</script>
4+
5+
<template>
6+
<div class="vp-doc">
7+
<h2 class="op50 font-normal pt-5 pb-2">
8+
Contributors
9+
</h2>
10+
</div>
11+
<div class="text-lg max-w-200 text-center leading-7 p-10">
12+
<div class="flex flex-wrap gap-1 justify-center">
13+
<a v-for="{ name, avatar } of contributors" :key="name" :href="`https://github.com/${name}`" class="m-0" rel="noopener noreferrer" :aria-label="`${name} on GitHub`">
14+
<img loading="lazy" :src="avatar" width="40" height="40" class="rounded-full min-w-10 min-h-10 h-10 w-10" :alt="`${name}'s avatar`">
15+
</a>
16+
</div>
17+
<br>
18+
</div>
19+
</template>

Diff for: docs/.vitepress/components/HomePage.vue

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { VPTeamMembers } from 'vitepress/theme'
33
import { computed } from 'vue'
44
import { useTranslate } from '../i18n/composable'
55
6+
import HomeContributors from './HomeContributors.vue'
7+
68
const t = useTranslate()
79
810
const members = computed(() => [
@@ -23,10 +25,6 @@ const members = computed(() => [
2325
<div flex="~ col wrap" mt8 items-center>
2426
<VPTeamMembers size="small" :members="members" />
2527

26-
<br />
27-
28-
<a href="https://github.com/agiletech-web-dev/js-utils-es/graphs/contributors">
29-
<img src="https://contrib.rocks/image?repo=agiletech-web-dev/js-utils-es" />
30-
</a>
28+
<HomeContributors />
3129
</div>
3230
</template>

Diff for: docs/.vitepress/locale.ts

+7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function getLocaleConfig(lang: string) {
5151
items: [
5252
{
5353
text: t('Array Utilities'),
54+
collapsed: false,
5455
items: [
5556
{ text: 'chunk', link: '/reference/array/chunk' },
5657
{ text: 'countBy', link: '/reference/array/countBy' },
@@ -109,6 +110,7 @@ export function getLocaleConfig(lang: string) {
109110
},
110111
{
111112
text: t('Function Utilities'),
113+
collapsed: false,
112114
items: [
113115
{ text: 'debounce', link: '/reference/function/debounce' },
114116
{ text: 'throttle', link: '/reference/function/throttle' },
@@ -119,6 +121,7 @@ export function getLocaleConfig(lang: string) {
119121
},
120122
{
121123
text: t('Math Utilities'),
124+
collapsed: false,
122125
items: [
123126
{ text: 'clamp', link: '/reference/math/clamp' },
124127
{ text: 'inRange', link: '/reference/math/inRange' },
@@ -136,6 +139,7 @@ export function getLocaleConfig(lang: string) {
136139
},
137140
{
138141
text: t('Object Utilities'),
142+
collapsed: false,
139143
items: [
140144
{ text: 'clone', link: '/reference/object/clone' },
141145
{ text: 'omit', link: '/reference/object/omit' },
@@ -147,6 +151,7 @@ export function getLocaleConfig(lang: string) {
147151
},
148152
{
149153
text: t('Predicates'),
154+
collapsed: false,
150155
items: [
151156
{ text: 'isBoolean', link: '/reference/predicate/isBoolean' },
152157
{ text: 'isDate', link: '/reference/predicate/isDate' },
@@ -165,13 +170,15 @@ export function getLocaleConfig(lang: string) {
165170
},
166171
{
167172
text: t('Promise Utilities'),
173+
collapsed: false,
168174
items: [
169175
{ text: 'delay', link: '/reference/promise/delay' },
170176
{ text: 'pChain', link: '/reference/promise/pChain' },
171177
],
172178
},
173179
{
174180
text: t('String Utilities'),
181+
collapsed: false,
175182
items: [
176183
{ text: 'snakeCase', link: '/reference/string/snakeCase' },
177184
{ text: 'kebabCase', link: '/reference/string/kebabCase' },

Diff for: docs/.vitepress/theme/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import Theme from 'vitepress/theme'
22
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
33
import type { EnhanceAppContext } from 'vitepress'
4-
import 'uno.css'
54
import './style.css'
65
// import '@nolebase/vitepress-plugin-git-changelog/client/style.css'
76
import '@shikijs/vitepress-twoslash/style.css'
87
import Contributors from '../components/Contributors.vue'
98
import Changelog from '../components/Changelog.vue'
109
import Layout from './Layout.vue'
10+
import 'uno.css'
1111

1212
export default {
1313
...Theme,

Diff for: docs/.vitepress/theme/style.css

+9
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,12 @@
191191
border-radius: 12px;
192192
background: var(--vp-c-bg-soft);
193193
}
194+
195+
.vp-doc h2 {
196+
margin: 48px 0 16px;
197+
border-top: 1px solid var(--vp-c-divider);
198+
padding-top: 24px;
199+
letter-spacing: -.02em;
200+
line-height: 32px;
201+
font-size: 24px;
202+
}

Diff for: scripts/contributors.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"hunghg255"
3+
]

Diff for: scripts/contributors.ts

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import contributors from './contributors.json'
2+
3+
export interface Contributor {
4+
name: string
5+
avatar: string
6+
}
7+
8+
export interface CoreTeam {
9+
avatar: string
10+
name: string
11+
github: string
12+
twitter?: string
13+
sponsors?: boolean
14+
description: string
15+
packages?: string[]
16+
functions?: string[]
17+
}
18+
19+
const contributorsAvatars: Record<string, string> = {}
20+
21+
function getAvatarUrl(name: string) {
22+
return `https://avatars.githubusercontent.com/${name}?v=4`
23+
}
24+
25+
const contributorList = (contributors as string[]).reduce((acc, name) => {
26+
contributorsAvatars[name] = getAvatarUrl(name)
27+
acc.push({ name, avatar: contributorsAvatars[name] })
28+
return acc
29+
}, [] as Contributor[])
30+
31+
export { contributorList as contributors }

0 commit comments

Comments
 (0)