Skip to content

Commit

Permalink
docs: update contribute style
Browse files Browse the repository at this point in the history
  • Loading branch information
hunghg255 committed Jul 18, 2024
1 parent a0635cb commit 9802fbe
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 6 deletions.
19 changes: 19 additions & 0 deletions docs/.vitepress/components/HomeContributors.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { contributors } from '../../../scripts/contributors';
</script>

<template>
<div class="vp-doc">
<h2 class="op50 font-normal pt-5 pb-2">
Contributors
</h2>
</div>
<div class="text-lg max-w-200 text-center leading-7 p-10">
<div class="flex flex-wrap gap-1 justify-center">
<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`">
<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`">
</a>
</div>
<br>
</div>
</template>
8 changes: 3 additions & 5 deletions docs/.vitepress/components/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { VPTeamMembers } from 'vitepress/theme'
import { computed } from 'vue'
import { useTranslate } from '../i18n/composable'
import HomeContributors from './HomeContributors.vue'
const t = useTranslate()
const members = computed(() => [
Expand All @@ -23,10 +25,6 @@ const members = computed(() => [
<div flex="~ col wrap" mt8 items-center>
<VPTeamMembers size="small" :members="members" />

<br />

<a href="https://github.com/agiletech-web-dev/js-utils-es/graphs/contributors">
<img src="https://contrib.rocks/image?repo=agiletech-web-dev/js-utils-es" />
</a>
<HomeContributors />
</div>
</template>
7 changes: 7 additions & 0 deletions docs/.vitepress/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function getLocaleConfig(lang: string) {
items: [
{
text: t('Array Utilities'),
collapsed: false,
items: [
{ text: 'chunk', link: '/reference/array/chunk' },
{ text: 'countBy', link: '/reference/array/countBy' },
Expand Down Expand Up @@ -109,6 +110,7 @@ export function getLocaleConfig(lang: string) {
},
{
text: t('Function Utilities'),
collapsed: false,
items: [
{ text: 'debounce', link: '/reference/function/debounce' },
{ text: 'throttle', link: '/reference/function/throttle' },
Expand All @@ -119,6 +121,7 @@ export function getLocaleConfig(lang: string) {
},
{
text: t('Math Utilities'),
collapsed: false,
items: [
{ text: 'clamp', link: '/reference/math/clamp' },
{ text: 'inRange', link: '/reference/math/inRange' },
Expand All @@ -136,6 +139,7 @@ export function getLocaleConfig(lang: string) {
},
{
text: t('Object Utilities'),
collapsed: false,
items: [
{ text: 'clone', link: '/reference/object/clone' },
{ text: 'omit', link: '/reference/object/omit' },
Expand All @@ -147,6 +151,7 @@ export function getLocaleConfig(lang: string) {
},
{
text: t('Predicates'),
collapsed: false,
items: [
{ text: 'isBoolean', link: '/reference/predicate/isBoolean' },
{ text: 'isDate', link: '/reference/predicate/isDate' },
Expand All @@ -165,13 +170,15 @@ export function getLocaleConfig(lang: string) {
},
{
text: t('Promise Utilities'),
collapsed: false,
items: [
{ text: 'delay', link: '/reference/promise/delay' },
{ text: 'pChain', link: '/reference/promise/pChain' },
],
},
{
text: t('String Utilities'),
collapsed: false,
items: [
{ text: 'snakeCase', link: '/reference/string/snakeCase' },
{ text: 'kebabCase', link: '/reference/string/kebabCase' },
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Theme from 'vitepress/theme'
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
import type { EnhanceAppContext } from 'vitepress'
import 'uno.css'
import './style.css'
// import '@nolebase/vitepress-plugin-git-changelog/client/style.css'
import '@shikijs/vitepress-twoslash/style.css'
import Contributors from '../components/Contributors.vue'
import Changelog from '../components/Changelog.vue'
import Layout from './Layout.vue'
import 'uno.css'

export default {
...Theme,
Expand Down
9 changes: 9 additions & 0 deletions docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,12 @@
border-radius: 12px;
background: var(--vp-c-bg-soft);
}

.vp-doc h2 {
margin: 48px 0 16px;
border-top: 1px solid var(--vp-c-divider);
padding-top: 24px;
letter-spacing: -.02em;
line-height: 32px;
font-size: 24px;
}
3 changes: 3 additions & 0 deletions scripts/contributors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
"hunghg255"
]
31 changes: 31 additions & 0 deletions scripts/contributors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import contributors from './contributors.json'

export interface Contributor {
name: string
avatar: string
}

export interface CoreTeam {
avatar: string
name: string
github: string
twitter?: string
sponsors?: boolean
description: string
packages?: string[]
functions?: string[]
}

const contributorsAvatars: Record<string, string> = {}

function getAvatarUrl(name: string) {
return `https://avatars.githubusercontent.com/${name}?v=4`
}

const contributorList = (contributors as string[]).reduce((acc, name) => {
contributorsAvatars[name] = getAvatarUrl(name)
acc.push({ name, avatar: contributorsAvatars[name] })
return acc
}, [] as Contributor[])

export { contributorList as contributors }

0 comments on commit 9802fbe

Please sign in to comment.