From 9802fbeb6a0dce835b54f2fff3b205a995121af1 Mon Sep 17 00:00:00 2001 From: hunghg255 Date: Thu, 18 Jul 2024 16:53:33 +0700 Subject: [PATCH] docs: update contribute style --- .../components/HomeContributors.vue | 19 ++++++++++++ docs/.vitepress/components/HomePage.vue | 8 ++--- docs/.vitepress/locale.ts | 7 +++++ docs/.vitepress/theme/index.ts | 2 +- docs/.vitepress/theme/style.css | 9 ++++++ scripts/contributors.json | 3 ++ scripts/contributors.ts | 31 +++++++++++++++++++ 7 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 docs/.vitepress/components/HomeContributors.vue create mode 100644 scripts/contributors.json create mode 100644 scripts/contributors.ts diff --git a/docs/.vitepress/components/HomeContributors.vue b/docs/.vitepress/components/HomeContributors.vue new file mode 100644 index 0000000..e8d6992 --- /dev/null +++ b/docs/.vitepress/components/HomeContributors.vue @@ -0,0 +1,19 @@ + + + diff --git a/docs/.vitepress/components/HomePage.vue b/docs/.vitepress/components/HomePage.vue index c9822a6..7c3103b 100644 --- a/docs/.vitepress/components/HomePage.vue +++ b/docs/.vitepress/components/HomePage.vue @@ -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(() => [ @@ -23,10 +25,6 @@ const members = computed(() => [
-
- - - - +
diff --git a/docs/.vitepress/locale.ts b/docs/.vitepress/locale.ts index 5416c4a..277d311 100644 --- a/docs/.vitepress/locale.ts +++ b/docs/.vitepress/locale.ts @@ -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' }, @@ -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' }, @@ -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' }, @@ -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' }, @@ -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' }, @@ -165,6 +170,7 @@ export function getLocaleConfig(lang: string) { }, { text: t('Promise Utilities'), + collapsed: false, items: [ { text: 'delay', link: '/reference/promise/delay' }, { text: 'pChain', link: '/reference/promise/pChain' }, @@ -172,6 +178,7 @@ export function getLocaleConfig(lang: string) { }, { text: t('String Utilities'), + collapsed: false, items: [ { text: 'snakeCase', link: '/reference/string/snakeCase' }, { text: 'kebabCase', link: '/reference/string/kebabCase' }, diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 8720290..b4d1394 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -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, diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.css index 376939d..5d73f0b 100644 --- a/docs/.vitepress/theme/style.css +++ b/docs/.vitepress/theme/style.css @@ -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; +} diff --git a/scripts/contributors.json b/scripts/contributors.json new file mode 100644 index 0000000..0fc340c --- /dev/null +++ b/scripts/contributors.json @@ -0,0 +1,3 @@ +[ + "hunghg255" +] diff --git a/scripts/contributors.ts b/scripts/contributors.ts new file mode 100644 index 0000000..382a37c --- /dev/null +++ b/scripts/contributors.ts @@ -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 = {} + +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 }