Skip to content

Commit

Permalink
Fixed translations
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-marshall committed Jan 27, 2025
1 parent e91e1e5 commit fc64ab8
Show file tree
Hide file tree
Showing 31 changed files with 1,910 additions and 493 deletions.
273 changes: 190 additions & 83 deletions .vitepress/config.ts

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .vitepress/inlined-scripts/restorePreference.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
document.documentElement.classList.add(cls)
}
}
restore('vue-docs-prefer-composition', 'prefer-composition')
restore('vue-docs-prefer-composition', 'prefer-composition', true)
restore('vue-docs-prefer-sfc', 'prefer-sfc', true)

// window.__VUE_BANNER_ID__ = ''
// restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
window.__VUE_BANNER_ID__ = 'madvue2025_1'
restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
})()
3 changes: 3 additions & 0 deletions .vitepress/inlined-scripts/uwu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if (location.search.includes('?uwu')) {
document.documentElement.classList.add('uwu')
}
26 changes: 13 additions & 13 deletions .vitepress/jobsMdPlugin.ts → .vitepress/textAdMdPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import MarkdownIt from 'markdown-it'

const excludedPages = [
'guide/introduction.md',
'guide/quick-start.md',
'guide/essentials/computed.md',
'guide/essentials/conditional.md',
'guide/essentials/list.md',
'guide/essentials/event-handling.md',
'guide/essentials/forms.md',
'guide/components/registration.md',
'guide/components/props.md',
'guide/components/events.md',
'guide/components/slots.md',
'guide/built-ins/teleport.md',
// 'guide/quick-start.md',
// 'guide/essentials/computed.md',
// 'guide/essentials/conditional.md',
// 'guide/essentials/list.md',
// 'guide/essentials/event-handling.md',
// 'guide/essentials/forms.md',
// 'guide/components/registration.md',
// 'guide/components/props.md',
// 'guide/components/events.md',
// 'guide/components/slots.md',
// 'guide/built-ins/teleport.md',
'about/faq.md',
'about/team.md',
'about/releases.md',
Expand All @@ -22,13 +22,13 @@ const excludedPages = [
'translations/index.md'
]

export const jobsPlugin = (md: MarkdownIt) => {
export const textAdPlugin = (md: MarkdownIt) => {
md.renderer.rules.heading_close = (tokens, i, options, env, self) => {
const relativePath = env.relativePath
const renderedContent = self.renderToken(tokens, i, options)

return excludedPages.includes(relativePath)
? renderedContent
: renderedContent.replace(/<\/h1>/, '</h1><VueJobs/>')
: renderedContent.replace(/<\/h1>/, '</h1><TextAd/>')
}
}
118 changes: 112 additions & 6 deletions .vitepress/theme/components/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,44 @@
* 2. uncomment and update BANNER_ID in ../../inlined-scripts/restorePreferences.ts
* 3. update --vt-banner-height if necessary
*/
import { ref } from 'vue'
import { VTIconPlus } from '@vue/theme'
const open = ref(true)
let open = $ref(true)
/**
* Call this if the banner is dismissible
*/
function dismiss() {
open = false
open.value = false
document.documentElement.classList.add('banner-dismissed')
localStorage.setItem(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'true')
}
</script>

<template>
<div class="banner" v-if="open"></div>
<div class="banner" v-if="open">
<p class="vt-banner-text">
<span class="vt-text-primary">
<span style="color:#f97844">Mad</span>
<span>Vue</span>
</span>
<span class="vt-tagline"> · The Vue.js Event in Madrid</span>
<span class="vt-place"> · Spain</span>
<span class="vt-date"> · 29 May 2025</span>
<a target="_blank" class="vt-primary-action"
href="https://madvue.es/?utm_source=vuejs&utm_content=top_banner">
Register
</a>
</p>
<button @click="dismiss">
<VTIconPlus class="close" />
</button>
<p class="vt-banner-text vt-coupon">
<span class="vt-text-primary">Early bird</span> tickets available
<span class="vt-text-primary">Get 30% off</span>
</p>
</div>
</template>

<style>
Expand All @@ -36,15 +60,97 @@ html:not(.banner-dismissed) {
left: 0;
right: 0;
height: var(--vt-banner-height);
line-height: 0;
line-height: var(--vt-banner-height);
text-align: center;
font-size: 12px;
font-size: 13px;
font-weight: 600;
color: #fff;
background-color: var(--vt-c-green);
background: #0f172a;
display: flex;
justify-content: center;
align-items: center;
}
.banner-dismissed .banner {
display: none;
}
</style>
a:hover {
text-decoration: underline;
}
button {
position: absolute;
right: 0;
top: 0;
padding: 20px 10px;
}
.close {
width: 20px;
height: 20px;
fill: #fff;
transform: rotate(45deg);
}
.vt-banner-text {
color: #fff;
font-size: 16px;
}
.vt-text-primary {
color: #c4d141;
}
.vt-primary-action {
background: #f97844;
color: #fff;
padding: 6px 12px;
border-radius: 5px;
font-size: 14px;
text-decoration: none;
margin: 0 20px;
font-weight: bold;
}
.vt-primary-action:hover {
text-decoration: none;
background: #c4d141;
}
@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: 5px 8px;
}
.vt-time-now {
display: none;
}
}
@media (max-width: 560px) {
.vt-place {
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 fc64ab8

Please sign in to comment.