fix: переключатель языка и иконка репозитория в шапке

- восстановлены link для локалей: ru → /ru/, en → /en/ (были сломаны на /)
- добавлена иконка GitHub в socialLinks шапки VitePress для ru и en
  со ссылкой на https://gromlab.ru/docs/nextjs-style-guide
- root-локаль скрыта из переключателя языка через CSS (display: none
  для href="/"): в дропдауне теперь только Русский и English
- pill-кнопка «Репозиторий» добавлена в блок controls лендинга
  с иконкой GitHub, открывается в новой вкладке
- мобильная вёрстка лендинга переработана: контролы стопкой,
  репозиторий на ≤480px сжимается до иконки 36x36, увеличены
  отступы между блоками (hero / controls / cards) для разделения
This commit is contained in:
2026-04-25 21:14:17 +03:00
parent 464c709859
commit 5cf0f0f8ba
3 changed files with 102 additions and 4 deletions

View File

@@ -141,10 +141,13 @@ export default defineConfig({
ru: {
label: 'Русский',
lang: 'ru-RU',
link: '/',
link: '/ru/',
description: 'Стандарты разработки на Next.js + TypeScript с архитектурой SLM',
themeConfig: {
sidebar: ruSidebar,
socialLinks: [
{ icon: 'github', link: 'https://gromlab.ru/docs/nextjs-style-guide' },
],
},
// Расширенный блок описания для llms.txt — даёт LLM полный
// технический контекст: стек, методология, охват тем.
@@ -156,10 +159,13 @@ export default defineConfig({
en: {
label: 'English',
lang: 'en-US',
link: '/',
link: '/en/',
description: 'Next.js + TypeScript development standards with SLM architecture',
themeConfig: {
sidebar: enSidebar,
socialLinks: [
{ icon: 'github', link: 'https://gromlab.ru/docs/nextjs-style-guide' },
],
},
llmsBlockquote:
'Frontend development standards for Next.js (App Router) + TypeScript + React projects with SLM architecture (Scoped Layered Module Design — a modular architecture with responsibility layers, where each module contains everything it needs: components, hooks, stores, types, styles).',

View File

@@ -15,3 +15,14 @@
max-width: 100%;
overflow-wrap: anywhere;
}
/*
* Скрыть root-локаль (лендинг с layout: false) из переключателя языка.
* VitePress не даёт исключить root через config — она всегда попадает
* в lang-switcher. Идентифицируем по href="/" — другие локали используют
* href="/ru/" и href="/en/".
*/
.VPNavBarTranslations a[href="/"],
.VPNavScreenTranslations a[href="/"] {
display: none;
}

View File

@@ -17,6 +17,7 @@ const dict = {
tagline: 'Соглашения по разработке Next.js проектов: архитектура и слои приложения, структура кода, организация модулей, стилизация, типизация и инфраструктура.',
langLabel: 'Язык',
themeLabel: 'Тема',
repoLabel: 'Репозиторий',
themes: { auto: 'Авто', light: 'Светлая', dark: 'Тёмная' },
cards: {
docs: {
@@ -45,6 +46,7 @@ const dict = {
tagline: 'Conventions for Next.js project development: application architecture and layers, code structure, module organization, styling, typing, and infrastructure.',
langLabel: 'Language',
themeLabel: 'Theme',
repoLabel: 'Repository',
themes: { auto: 'Auto', light: 'Light', dark: 'Dark' },
cards: {
docs: {
@@ -124,6 +126,17 @@ function toggleTheme(value) {
<ClientOnly>
<p class="landing__tagline">{{ t.tagline }}</p>
<div class="landing__controls">
<a
class="landing__repo"
href="https://gromlab.ru/docs/nextjs-style-guide"
target="_blank"
rel="noopener"
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/>
</svg>
<span>{{ t.repoLabel }}</span>
</a>
<div class="seg" role="group" :aria-label="t.langLabel">
<button
type="button"
@@ -234,6 +247,35 @@ function toggleTheme(value) {
flex-wrap: wrap;
}
.landing__controls > * {
height: 36px;
box-sizing: border-box;
}
.landing__repo {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 0 14px;
border: 1px solid var(--vp-c-divider);
border-radius: 999px;
background: var(--vp-c-bg-soft);
color: var(--vp-c-text-2);
font-size: 13px;
font-weight: 500;
text-decoration: none;
transition: color 0.15s, border-color 0.15s;
}
.landing__repo:hover {
color: var(--vp-c-text-1);
border-color: var(--vp-c-brand-1);
}
.landing__repo svg {
flex-shrink: 0;
}
.seg {
display: inline-flex;
align-items: stretch;
@@ -410,17 +452,56 @@ function toggleTheme(value) {
@media (max-width: 768px) {
.landing {
padding: 16px 16px 48px;
gap: 32px;
padding: 48px 20px 56px;
gap: 40px;
justify-content: flex-start;
}
.landing__title {
font-size: 36px;
}
.landing__tagline {
font-size: 16px;
}
.landing__cards {
grid-template-columns: 1fr;
gap: 16px;
}
.landing__controls {
gap: 8px;
margin-top: 36px;
}
}
@media (max-width: 480px) {
.landing {
padding: 44px 16px 48px;
gap: 36px;
}
.landing__title {
font-size: 30px;
}
.landing__tagline {
font-size: 15px;
line-height: 1.5;
}
.landing__controls {
margin-top: 32px;
}
/* Репозиторий — только иконка, без текста, чтобы все контролы влезли в строку */
.landing__repo {
width: 36px;
padding: 0;
justify-content: center;
}
.landing__repo span {
display: none;
}
.seg__btn {
padding: 6px 12px;
font-size: 12px;
}
.landing__card {
padding: 20px;
}
}
</style>