modified: main_dc/yalarba/easySite/easySite/app/assets/css/fonts.css

new file:   main_dc/yalarba/easySite/easySite/app/components/layout/HamburgerMenu.vue
	modified:   main_dc/yalarba/easySite/easySite/app/components/layout/Header.vue
	modified:   main_dc/yalarba/easySite/easySite/app/composables/useTheme.ts
	new file:   main_dc/yalarba/easySite/easySite/public/fonts/Lora-Regular.woff2
	new file:   main_dc/yalarba/easySite/easySite/public/fonts/Manrope-ExtraLight.woff2
	new file:   main_dc/yalarba/easySite/easySite/public/fonts/SourceSansPro-Regular.woff2
add fonts theme and add humbergerMenu
This commit is contained in:
2025-10-30 04:08:00 +05:00
parent b168ec42c2
commit eb44f3efbd
7 changed files with 708 additions and 204 deletions
@@ -4,40 +4,40 @@
/* Inter - основной текст */
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter-Regular.woff2') format('woff2');
font-family: "Inter";
src: url("/fonts/Inter-Regular.woff2") format("woff2");
font-weight: 300;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter-Regular.woff2') format('woff2');
font-family: "Inter";
src: url("/fonts/Inter-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter-Regular.woff2') format('woff2');
font-family: "Inter";
src: url("/fonts/Inter-Regular.woff2") format("woff2");
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter-Regular.woff2') format('woff2');
font-family: "Inter";
src: url("/fonts/Inter-Regular.woff2") format("woff2");
font-weight: 600;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter-Regular.woff2') format('woff2');
font-family: "Inter";
src: url("/fonts/Inter-Regular.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -45,32 +45,32 @@
/* Playfair Display - заголовки */
@font-face {
font-family: 'Playfair Display';
src: url('/fonts/PlayfairDisplay-Regular.woff2') format('woff2');
font-family: "Playfair Display";
src: url("/fonts/PlayfairDisplay-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Playfair Display';
src: url('/fonts/PlayfairDisplay-Regular.woff2') format('woff2');
font-family: "Playfair Display";
src: url("/fonts/PlayfairDisplay-Regular.woff2") format("woff2");
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Playfair Display';
src: url('/fonts/PlayfairDisplay-Regular.woff2') format('woff2');
font-family: "Playfair Display";
src: url("/fonts/PlayfairDisplay-Regular.woff2") format("woff2");
font-weight: 600;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Playfair Display';
src: url('/fonts/PlayfairDisplay-Regular.woff2') format('woff2');
font-family: "Playfair Display";
src: url("/fonts/PlayfairDisplay-Regular.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -78,8 +78,8 @@
/* JetBrains Mono - моноширинный (для кода, деталей) */
@font-face {
font-family: 'JetBrains Mono';
src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2');
font-family: "JetBrains Mono";
src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -87,34 +87,35 @@
:root {
/* Шрифтовые семейства - Набор 1 */
--font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--font-heading: 'Playfair Display', 'Times New Roman', serif;
--font-accent: 'JetBrains Mono', 'Courier New', monospace;
--font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
sans-serif;
--font-heading: "Playfair Display", "Times New Roman", serif;
--font-accent: "JetBrains Mono", "Courier New", monospace;
/* Размеры шрифтов */
--text-xs: 0.75rem; /* 12px */
--text-sm: 0.875rem; /* 14px */
--text-base: 1rem; /* 16px */
--text-lg: 1.125rem; /* 18px */
--text-xl: 1.25rem; /* 20px */
--text-2xl: 1.5rem; /* 24px */
--text-3xl: 1.875rem; /* 30px */
--text-4xl: 2.25rem; /* 36px */
--text-5xl: 3rem; /* 48px */
--text-6xl: 3.75rem; /* 60px */
--text-xs: 0.75rem; /* 12px */
--text-sm: 0.875rem; /* 14px */
--text-base: 1rem; /* 16px */
--text-lg: 1.125rem; /* 18px */
--text-xl: 1.25rem; /* 20px */
--text-2xl: 1.5rem; /* 24px */
--text-3xl: 1.875rem; /* 30px */
--text-4xl: 2.25rem; /* 36px */
--text-5xl: 3rem; /* 48px */
--text-6xl: 3.75rem; /* 60px */
/* Высота строк */
--leading-tight: 1.25;
--leading-normal: 1.5;
--leading-relaxed: 1.75;
--leading-loose: 2;
/* Межбуквенные интервалы */
--tracking-tight: -0.025em;
--tracking-normal: 0;
--tracking-wide: 0.025em;
--tracking-wider: 0.05em;
/* Насыщенность шрифтов */
--font-light: 300;
--font-normal: 400;
@@ -122,4 +123,114 @@
--font-semibold: 600;
--font-bold: 700;
--font-extrabold: 800;
}
}
/* ===== НАБОР 2: ЭЛЕГАНТНЫЙ И МИНИМАЛИСТИЧНЫЙ ===== */
/* Manrope - основной текст */
@font-face {
font-family: "Manrope";
src: url("/fonts/Manrope-ExtraLight.woff2") format("woff2");
font-weight: 300;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Manrope";
src: url("/fonts/Manrope-ExtraLight.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Manrope";
src: url("/fonts/Manrope-ExtraLight.woff2") format("woff2");
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Manrope";
src: url("/fonts/Manrope-ExtraLight.woff2") format("woff2");
font-weight: 600;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Manrope";
src: url("/fonts/Manrope-ExtraLight.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
}
/* Lora - заголовки */
@font-face {
font-family: "Lora";
src: url("/fonts/Lora-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Lora";
src: url("/fonts/Lora-Regular.woff2") format("woff2");
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Lora";
src: url("/fonts/Lora-Regular.woff2") format("woff2");
font-weight: 600;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Lora";
src: url("/fonts/Lora-Regular.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
}
/* Source Sans Pro - акцентный */
@font-face {
font-family: "Source Sans Pro";
src: url("/fonts/SourceSansPro-Regular.woff2") format("woff2");
font-weight: 300;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Source Sans Pro";
src: url("/fonts/SourceSansPro-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Source Sans Pro";
src: url("/fonts/SourceSansPro-Regular.woff2") format("woff2");
font-weight: 600;
font-style: normal;
font-display: swap;
}
/* Альтернативные переменные для Набора 2 */
:root[data-font-set="elegant"] {
/* Шрифтовые семейства - Набор 2 */
--font-primary: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, sans-serif;
--font-heading: "Lora", "Times New Roman", serif;
--font-accent: "Source Sans Pro", "Arial", sans-serif;
}
@@ -0,0 +1,502 @@
<template>
<div class="hamburger-menu">
<!-- Кнопка гамбургера -->
<button
@click="toggleMenu"
class="hamburger-button"
:class="{ 'active': isOpen }"
aria-label="Меню"
>
<span class="hamburger-line"></span>
<span class="hamburger-line"></span>
<span class="hamburger-line"></span>
</button>
<!-- Затемнение фона -->
<div
v-if="isOpen"
class="menu-overlay"
@click="closeMenu"
></div>
<!-- Само меню -->
<transition name="slide-left">
<div v-if="isOpen" class="menu-content">
<!-- Заголовок меню -->
<div class="menu-header">
<div class="user-info" v-if="false"> <!-- Можно добавить позже -->
<div class="user-avatar">👤</div>
<div class="user-details">
<div class="user-name">Гость</div>
<div class="user-status">Не авторизован</div>
</div>
</div>
<h3 class="menu-title">Меню</h3>
<button @click="closeMenu" class="close-button" aria-label="Закрыть">
</button>
</div>
<!-- Настройки тем -->
<div class="menu-section">
<h4 class="menu-section-title">Настройки</h4>
<!-- Переключатель темы -->
<div class="menu-item toggle-item">
<div class="toggle-label">
<span class="toggle-icon">🌙</span>
<span class="toggle-text">Темная тема</span>
</div>
<button
@click="toggleTheme"
class="theme-toggle"
:class="{ 'active': theme === 'dark' }"
aria-label="Переключить тему"
>
<span class="toggle-slider"></span>
</button>
</div>
<!-- Переключатель шрифтов -->
<div class="menu-item toggle-item">
<div class="toggle-label">
<span class="toggle-icon">🔤</span>
<span class="toggle-text">Элегантный шрифт</span>
</div>
<button
@click="toggleFontSet"
class="font-toggle"
:class="{ 'active': fontSet === 'elegant' }"
aria-label="Переключить шрифт"
>
<span class="toggle-slider"></span>
</button>
</div>
</div>
<!-- Навигация -->
<div class="menu-section">
<h4 class="menu-section-title">Аккаунт</h4>
<NuxtLink to="/profile" class="menu-item" @click="closeMenu">
<span class="menu-icon">👤</span>
<span class="menu-text">Профиль</span>
</NuxtLink>
<NuxtLink to="/auth/register" class="menu-item" @click="closeMenu">
<span class="menu-icon">📝</span>
<span class="menu-text">Регистрация</span>
</NuxtLink>
<NuxtLink to="/auth/login" class="menu-item" @click="closeMenu">
<span class="menu-icon">🔑</span>
<span class="menu-text">Вход</span>
</NuxtLink>
</div>
<!-- Дополнительные ссылки -->
<div class="menu-section">
<h4 class="menu-section-title">Навигация</h4>
<NuxtLink to="/" class="menu-item" @click="closeMenu">
<span class="menu-icon">🏠</span>
<span class="menu-text">Главная</span>
</NuxtLink>
<NuxtLink to="/objects" class="menu-item" @click="closeMenu">
<span class="menu-icon">🔍</span>
<span class="menu-text">Все объекты</span>
</NuxtLink>
<NuxtLink to="/objects/create" class="menu-item" @click="closeMenu">
<span class="menu-icon"></span>
<span class="menu-text">Добавить объект</span>
</NuxtLink>
<a href="#" class="menu-item" @click="closeMenu">
<span class="menu-icon"></span>
<span class="menu-text">Помощь</span>
</a>
<a href="#" class="menu-item" @click="closeMenu">
<span class="menu-icon">📞</span>
<span class="menu-text">Контакты</span>
</a>
</div>
<!-- Футер меню -->
<div class="menu-footer">
<div class="menu-version">v1.0.0</div>
<div class="menu-copyright">© 2024 EasySite</div>
</div>
</div>
</transition>
</div>
</template>
<script setup lang="ts">
const isOpen = ref(false)
const { theme, toggleTheme, fontSet, toggleFontSet } = useTheme()
const toggleMenu = () => {
isOpen.value = !isOpen.value
}
const closeMenu = () => {
isOpen.value = false
}
// Закрытие меню при нажатии ESC
const handleEscape = (event: KeyboardEvent) => {
if (event.key === 'Escape' && isOpen.value) {
closeMenu()
}
}
// Закрытие меню при изменении размера окна на десктоп
const handleResize = () => {
if (window.innerWidth >= 1024 && isOpen.value) {
closeMenu()
}
}
onMounted(() => {
document.addEventListener('keydown', handleEscape)
window.addEventListener('resize', handleResize)
})
onUnmounted(() => {
document.removeEventListener('keydown', handleEscape)
window.removeEventListener('resize', handleResize)
})
</script>
<style scoped>
.hamburger-menu {
position: relative;
}
/* Кнопка гамбургера */
.hamburger-button {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 2rem;
height: 1.5rem;
background: none;
border: none;
cursor: pointer;
padding: 0;
transition: all 0.3s ease;
}
.hamburger-button:hover {
opacity: 0.8;
transform: scale(1.05);
}
.hamburger-line {
width: 100%;
height: 2px;
background: var(--text-primary);
transition: all 0.3s ease;
border-radius: 1px;
}
.hamburger-button.active .hamburger-line:nth-child(1) {
transform: rotate(45deg) translate(6px, 6px);
}
.hamburger-button.active .hamburger-line:nth-child(2) {
opacity: 0;
}
.hamburger-button.active .hamburger-line:nth-child(3) {
transform: rotate(-45deg) translate(6px, -6px);
}
/* Затемнение фона */
.menu-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 998;
}
/* Контент меню */
.menu-content {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 380px;
max-width: 90vw;
background: var(--bg-primary);
box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
z-index: 999;
display: flex;
flex-direction: column;
overflow-y: auto;
border-left: 1px solid var(--border-light);
}
/* Анимация появления */
.slide-left-enter-active,
.slide-left-leave-active {
transition: transform 0.3s ease;
}
.slide-left-enter-from,
.slide-left-leave-to {
transform: translateX(100%);
}
/* Заголовок меню */
.menu-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem;
border-bottom: 1px solid var(--border-light);
background: var(--bg-secondary);
}
.user-info {
display: flex;
align-items: center;
gap: 0.75rem;
}
.user-avatar {
width: 2.5rem;
height: 2.5rem;
background: var(--primary-500);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
}
.user-details {
display: flex;
flex-direction: column;
}
.user-name {
font-weight: 600;
color: var(--text-primary);
font-size: 0.95rem;
}
.user-status {
font-size: 0.8rem;
color: var(--text-tertiary);
}
.menu-title {
font-family: var(--font-heading);
font-size: 1.25rem;
font-weight: 600;
color: var(--text-primary);
margin: 0;
}
.close-button {
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
color: var(--text-secondary);
padding: 0.25rem;
border-radius: var(--radius-sm);
transition: all 0.2s ease;
width: 2rem;
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
}
.close-button:hover {
color: var(--text-primary);
background: var(--bg-tertiary);
}
/* Секции меню */
.menu-section {
padding: 1.5rem;
border-bottom: 1px solid var(--border-light);
}
.menu-section:last-child {
border-bottom: none;
}
.menu-section-title {
font-family: var(--font-primary);
font-size: 0.875rem;
font-weight: 600;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 1rem;
}
/* Элементы меню */
.menu-item {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 0;
text-decoration: none;
color: var(--text-primary);
transition: all 0.2s ease;
border-radius: var(--radius-md);
cursor: pointer;
}
.menu-item:hover {
background: var(--bg-secondary);
color: var(--primary-600);
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.menu-icon {
font-size: 1.25rem;
width: 1.5rem;
text-align: center;
}
.menu-text {
font-family: var(--font-primary);
font-weight: 500;
font-size: 0.95rem;
flex: 1;
}
/* Переключатели */
.toggle-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 0;
}
.toggle-label {
display: flex;
align-items: center;
gap: 0.75rem;
flex: 1;
}
.toggle-icon {
font-size: 1.25rem;
width: 1.5rem;
text-align: center;
}
.toggle-text {
font-family: var(--font-primary);
font-weight: 500;
font-size: 0.95rem;
color: var(--text-primary);
}
/* Стили для тогглов */
.theme-toggle,
.font-toggle {
position: relative;
width: 3rem;
height: 1.5rem;
background: var(--gray-300);
border: none;
border-radius: 0.75rem;
cursor: pointer;
transition: all 0.3s ease;
padding: 0;
flex-shrink: 0;
}
.theme-toggle:hover,
.font-toggle:hover {
transform: scale(1.05);
}
.theme-toggle.active,
.font-toggle.active {
background: var(--primary-500);
}
.toggle-slider {
position: absolute;
top: 0.125rem;
left: 0.125rem;
width: 1.25rem;
height: 1.25rem;
background: white;
border-radius: 50%;
transition: all 0.3s ease;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.theme-toggle.active .toggle-slider,
.font-toggle.active .toggle-slider {
transform: translateX(1.5rem);
}
/* Футер меню */
.menu-footer {
margin-top: auto;
padding: 1.5rem;
border-top: 1px solid var(--border-light);
text-align: center;
background: var(--bg-secondary);
}
.menu-version {
font-size: 0.75rem;
color: var(--text-tertiary);
margin-bottom: 0.25rem;
}
.menu-copyright {
font-size: 0.75rem;
color: var(--text-tertiary);
}
/* Адаптивность для десктопа */
@media (min-width: 1024px) {
.menu-content {
width: 400px;
}
.hamburger-button {
width: 2.25rem;
height: 1.75rem;
}
}
@media (max-width: 480px) {
.menu-content {
width: 300px;
}
.menu-section {
padding: 1rem;
}
.menu-header {
padding: 1rem;
}
.menu-footer {
padding: 1rem;
}
}
</style>
@@ -10,39 +10,22 @@
<span class="logo-name">EasySite</span>
</NuxtLink>
<!-- Навигация -->
<nav class="nav">
<!-- Переключатель темы -->
<button @click="toggleTheme" class="theme-toggle" :title="theme === 'light' ? 'Темная тема' : 'Светлая тема'">
<span class="theme-icon" :class="theme">
<span class="sun"></span>
<span class="moon">🌙</span>
</span>
<span class="theme-text">{{ theme === 'light' ? 'Темная' : 'Светлая' }}</span>
</button>
<NuxtLink to="/profile" class="nav-link">
👤 Профиль
</NuxtLink>
<NuxtLink to="/auth/login" class="nav-link">
🔑 Войти
</NuxtLink>
<NuxtLink to="/auth/register" class="btn btn-primary nav-button">
📝 Регистрация
</NuxtLink>
</nav>
<!-- Гамбургер меню для всех устройств -->
<div class="hamburger-nav">
<HamburgerMenu />
</div>
</div>
</div>
</header>
</template>
<script setup lang="ts">
const { theme, toggleTheme } = useTheme()
import HamburgerMenu from '~/components/layout/HamburgerMenu.vue'
</script>
<style scoped>
.header {
background: var(--bg-primary); /* Теперь использует основной фон */
background: var(--bg-primary);
box-shadow: var(--shadow-sm);
position: sticky;
top: 0;
@@ -98,94 +81,8 @@ const { theme, toggleTheme } = useTheme()
transition: color 0.3s ease;
}
.nav {
display: flex;
align-items: center;
gap: 1rem;
flex-shrink: 0;
}
.nav-link {
color: var(--text-secondary);
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: var(--radius-md);
transition: all 0.3s ease;
font-weight: 500;
white-space: nowrap;
}
.nav-link:hover {
color: var(--primary-500);
background: var(--primary-50);
}
.nav-button {
white-space: nowrap;
flex-shrink: 0;
transition: all 0.3s ease;
}
/* Стили для переключателя темы */
.theme-toggle {
display: flex;
align-items: center;
gap: 0.5rem;
background: var(--bg-secondary);
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
padding: 0.5rem 0.75rem;
cursor: pointer;
transition: all 0.3s ease;
color: var(--text-secondary);
font-size: 0.875rem;
font-weight: 500;
}
.theme-toggle:hover {
background: var(--bg-tertiary);
border-color: var(--primary-300);
color: var(--text-primary);
}
.theme-icon {
position: relative;
width: 1.25rem;
height: 1.25rem;
display: flex;
align-items: center;
justify-content: center;
}
.theme-icon .sun,
.theme-icon .moon {
position: absolute;
transition: all 0.3s ease;
font-size: 1rem;
}
.theme-icon.light .sun {
opacity: 1;
transform: scale(1);
}
.theme-icon.light .moon {
opacity: 0;
transform: scale(0);
}
.theme-icon.dark .sun {
opacity: 0;
transform: scale(0);
}
.theme-icon.dark .moon {
opacity: 1;
transform: scale(1);
}
.theme-text {
white-space: nowrap;
.hamburger-nav {
display: block;
}
@media (max-width: 768px) {
@@ -193,19 +90,10 @@ const { theme, toggleTheme } = useTheme()
padding: 0.75rem 0;
}
.nav {
gap: 0.5rem;
}
.logo-name {
font-size: 1.25rem;
}
.nav-link {
padding: 0.5rem 0.75rem;
font-size: 0.875rem;
}
.logo-icon {
width: 2rem;
height: 2rem;
@@ -214,33 +102,11 @@ const { theme, toggleTheme } = useTheme()
.logo-text {
font-size: 1rem;
}
.theme-text {
display: none;
}
.theme-toggle {
padding: 0.5rem;
}
}
@media (max-width: 480px) {
.logo-name {
display: none;
}
.nav-link {
padding: 0.5rem;
font-size: 0.8rem;
}
.nav-link span {
display: none;
}
.nav-link::before {
content: attr(data-icon);
font-size: 1.1rem;
}
}
</style>
@@ -1,30 +1,55 @@
// composables/useTheme.ts
export const useTheme = () => {
const theme = ref<'light' | 'dark'>('light')
const setTheme = (newTheme: 'light' | 'dark') => {
theme.value = newTheme
document.documentElement.setAttribute('data-theme', newTheme)
localStorage.setItem('theme', newTheme)
const theme = ref<'light' | 'dark'>('light')
const fontSet = ref<'modern' | 'elegant'>('modern')
const setTheme = (newTheme: 'light' | 'dark') => {
theme.value = newTheme
if (process.client) {
document.documentElement.setAttribute('data-theme', newTheme)
localStorage.setItem('theme', newTheme)
}
const toggleTheme = () => {
const newTheme = theme.value === 'light' ? 'dark' : 'light'
setTheme(newTheme)
}
const toggleTheme = () => {
const newTheme = theme.value === 'light' ? 'dark' : 'light'
setTheme(newTheme)
}
const setFontSet = (newFontSet: 'modern' | 'elegant') => {
fontSet.value = newFontSet
if (process.client) {
document.documentElement.setAttribute('data-font-set', newFontSet)
localStorage.setItem('font-set', newFontSet)
}
// Инициализация темы при загрузке
onMounted(() => {
const savedTheme = localStorage.getItem('theme') as 'light' | 'dark'
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
const initialTheme = savedTheme || (systemPrefersDark ? 'dark' : 'light')
setTheme(initialTheme)
})
return {
theme: readonly(theme),
toggleTheme,
setTheme
}
const toggleFontSet = () => {
const newFontSet = fontSet.value === 'modern' ? 'elegant' : 'modern'
setFontSet(newFontSet)
}
// Инициализация при загрузке
onMounted(() => {
if (process.client) {
const savedTheme = localStorage.getItem('theme') as 'light' | 'dark'
const savedFontSet = localStorage.getItem('font-set') as 'modern' | 'elegant'
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
const initialTheme = savedTheme || (systemPrefersDark ? 'dark' : 'light')
const initialFontSet = savedFontSet || 'modern'
setTheme(initialTheme)
setFontSet(initialFontSet)
}
})
return {
theme: readonly(theme),
fontSet: readonly(fontSet),
toggleTheme,
setTheme,
toggleFontSet,
setFontSet
}
}