schon/storefront/app/components/ui/theme-toggle.vue
2026-02-27 21:59:51 +03:00

33 lines
No EOL
862 B
Vue

<template>
<button
@click="toggleTheme"
class="theme-toggle"
:aria-label="`Переключить на ${theme === 'light' ? 'тёмную' : 'светлую'} тему`"
>
<Icon v-if="theme === 'light'" name="line-md:moon-alt-loop" size="24" />
<Icon v-else name="line-md:sunny-outline-loop" size="24" />
</button>
</template>
<script setup lang="ts">
import { useThemes } from '@composables/themes';
const { theme, toggleTheme } = useThemes();
</script>
<style scoped lang="scss">
.theme-toggle {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: $default_border_radius;
padding: 8px;
cursor: pointer;
color: var(--color-text-primary);
transition: all 0.3s ease;
&:hover {
background: var(--color-surface-hover);
border-color: var(--color-accent);
}
}
</style>