Skip to content

Commit

Permalink
Merge pull request #1054 from vuejs-translations/sync
Browse files Browse the repository at this point in the history
Sync #f9c82f48
  • Loading branch information
Jinjiang authored Dec 30, 2024
2 parents 91aa936 + 768b987 commit ce9e312
Show file tree
Hide file tree
Showing 106 changed files with 7,067 additions and 1,336 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,5 @@ src/tutorial/data.json
draft.md

# IDEs
# folders created by IDE
.idea
11 changes: 8 additions & 3 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const nav: ThemeConfig['nav'] = [
text: '资源',
items: [
{ text: '合作伙伴', link: '/partners/' },
{ text: '开发者', link: '/developers/' },
{ text: '主题', link: '/ecosystem/themes' },
{ text: 'UI 组件', link: 'https://ui-libs.vercel.app/' },
{
Expand Down Expand Up @@ -125,9 +126,13 @@ const nav: ThemeConfig['nav'] = [
link: '/sponsor/'
},
{
text: '合作伙伴',
link: '/partners/',
activeMatch: `^/partners/`
text: '专家',
badge: { text: '新' },
activeMatch: `^/(partners|developers)/`,
items: [
{ text: '合作伙伴', link: '/partners/' },
{ text: '开发者', link: '/developers/', badge: { text: '新' } }
]
}
]

Expand Down
4 changes: 2 additions & 2 deletions .vitepress/inlined-scripts/restorePreference.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
restore('vue-docs-prefer-composition', 'prefer-composition', true)
restore('vue-docs-prefer-sfc', 'prefer-sfc', true)

window.__VUE_BANNER_ID__ = 'vt2024_1'
restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
// window.__VUE_BANNER_ID__ = ''
// restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
})()
88 changes: 13 additions & 75 deletions .vitepress/theme/components/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,16 @@ function dismiss() {

<template>
<div class="banner" v-if="open">
<p class="vt-banner-text">
<span class="vt-text-primary">VueConf Toronto</span>
<span class="vt-tagline"> - Join the premier Vue.js conference</span>
| 18-20 Nov 2024 <span class="vt-place"> - Toronto, Canada</span>
<a
target="_blank"
class="vt-primary-action"
href="https://vuetoronto.com/?utm_source=vuejs&utm_content=top_banner"
>
Register
</a>
</p>
<a target="_blank"></a>
<button @click="dismiss">
<VTIconPlus class="close" />
</button>
<p class="vt-banner-text vt-coupon">
<span class="vt-text-primary">Use code</span> VUEJS
<span class="vt-text-primary">to get 15% off</span>
</p>
</div>
</template>

<style>
html:not(.banner-dismissed) {
--vt-banner-height: 60px;
--vt-banner-height: 30px;
}
</style>

Expand All @@ -65,10 +50,12 @@ html:not(.banner-dismissed) {
font-weight: 600;
color: #fff;
background-color: var(--vt-c-green);
background: #11252b;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(
90deg,
rgba(66, 184, 131, 1) 0%,
rgba(39, 179, 137, 1) 19%,
rgba(100, 126, 255, 1) 100%
);
}
.banner-dismissed .banner {
Expand All @@ -83,7 +70,7 @@ button {
position: absolute;
right: 0;
top: 0;
padding: 20px 10px;
padding: 5px;
}
.close {
Expand All @@ -92,59 +79,10 @@ button {
fill: #fff;
transform: rotate(45deg);
}
.vt-banner-text {
color: #fff;
font-size: 16px;
}
.vt-text-primary {
color: #75c05e;
}
.vt-primary-action {
background: #75c05e;
color: #121c1a;
padding: 8px 15px;
border-radius: 5px;
font-size: 14px;
text-decoration: none;
margin: 0 20px;
font-weight: bold;
}
.vt-primary-action:hover {
text-decoration: none;
background: #5a9f45;
}
@media (max-width: 1280px) {
.banner .vt-banner-text {
font-size: 14px;
}
.vt-tagline {
display: none;
}
}
@media (max-width: 780px) {
.vt-tagline {
display: none;
}
.vt-coupon {
display: none;
}
.vt-primary-action {
margin: 0 10px;
padding: 7px 10px;
}
.vt-time-now {
display: none;
}
}
@media (max-width: 560px) {
.vt-place {
/*
@media (max-width: 720px) {
a > span {
display: none;
}
}
} */
</style>
73 changes: 73 additions & 0 deletions .vitepress/theme/components/CallToActionSection.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<script setup lang="ts">
withDefaults(defineProps<{
title?: string
description?: string
link?: string
linkText?: string
showDivider?: boolean
}>(), {
showDivider: true
})
</script>

<template>
<section class="cta-section">
<div v-if="showDivider" class="cta-divider"></div>
<div class="cta-content">
<h2 v-if="title" class="cta-title">{{ title }}</h2>
<p v-if="description" class="cta-description">{{ description }}</p>
<a v-if="link" :href="link" target="_blank" class="cta-link">{{ linkText }}</a>
<slot></slot>
</div>
</section>
</template>

<style scoped>
.cta-section {
text-align: center;
max-width: 688px;
margin: 0 auto;
}
.cta-divider {
width: 100px;
margin: 0 auto;
border-top: 1px solid var(--vt-c-divider-light);
}
.cta-content {
padding: 28px 28px 96px;
}
.cta-title {
font-size: 34px;
font-weight: 600;
letter-spacing: -0.5px;
line-height: 1.2;
margin: 0.5em 0 1em;
}
.cta-description {
color: var(--vt-c-text-2);
}
.cta-link {
margin-top: 2em;
display: inline-block;
padding: 12px 24px;
background-color: var(--vt-c-bg-mute);
color: var(--vt-c-text-code);
font-weight: 600;
border-radius: 6px;
text-decoration: none;
transition: background-color 0.5s, color 0.5s;
}
.cta-link:hover {
background-color: var(--vt-c-gray-light-4);
}
.dark .cta-link:hover {
background-color: var(--vt-c-gray-dark-3);
}
</style>
105 changes: 105 additions & 0 deletions .vitepress/theme/components/CardList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<script setup lang="ts">
import { computed, onMounted, ref, shallowRef } from 'vue'
const props = withDefaults(
defineProps<{
items: Array<any>
filter?: (item: any) => boolean
cardComponent: any
showLinkToAll?: boolean
shuffleItems?: boolean
browseLinkText?: string
browseLinkUrl?: string
splitBy?: string
}>(),
{
showLinkToAll: false,
shuffleItems: false,
splitBy: 'platinum'
}
)
const isMounted = ref(false)
const items = shallowRef([...props.items])
const filteredItems = computed(() =>
props.filter ? items.value.filter(props.filter) : items.value
)
onMounted(() => {
isMounted.value = true
items.value = processItems([...items.value], props.splitBy, props.shuffleItems)
})
function processItems(items: Array<any>, splitBy: string, shouldShuffle: boolean) {
const splitItems = items.filter(item => item[splitBy])
const otherItems = items.filter(item => !item[splitBy])
if (shouldShuffle) {
shuffleArray(splitItems)
shuffleArray(otherItems)
}
return [...splitItems, ...otherItems]
}
function shuffleArray(array: Array<any>) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1)); // don't remove semicolon
[array[i], array[j]] = [array[j], array[i]]
}
}
</script>

<template>
<div v-show="isMounted" class="card-list">
<!-- to skip SSG since the partners are shuffled -->
<ClientOnly>
<component
:is="cardComponent"
v-for="item in filteredItems"
:key="item.id || item.name"
:data="item"
/>
</ClientOnly>

<a
v-if="showLinkToAll && filteredItems.length % 2"
:href="browseLinkUrl"
class="browse-all-link"
>
{{ browseLinkText }}
</a>
</div>
</template>

<style scoped>
.card-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.browse-all-link {
display: block;
width: 48.5%;
margin-bottom: 36px;
padding-top: 240px;
font-size: 1.2em;
text-align: center;
color: var(--vt-c-text-2);
border: 1px solid var(--vt-c-divider-light);
border-radius: 4px;
transition: color 0.5s ease;
}
.browse-all-link:hover {
color: var(--vt-c-text-1);
}
@media (max-width: 768px) {
.browse-all-link {
display: none;
}
}
</style>
Loading

0 comments on commit ce9e312

Please sign in to comment.