ToggleTheme

This commit is contained in:
AntoXa PRO 2023-08-14 16:45:26 +03:00
parent 683d4375ff
commit b771d209ee
5 changed files with 60 additions and 17 deletions

View File

@ -1,7 +1,7 @@
{
"name": "axp-ui",
"descriiption": "My helper ui lib",
"version": "1.6.1",
"version": "1.6.2",
"homepage": "https://antoxahub.ru/antoxa/axp-ui",
"repository": {
"type": "git",

View File

@ -0,0 +1,21 @@
<script setup lang="ts">
import UiIcon from './Icon.vue'
// Props.
const props = defineProps<{
dark?: boolean
}>()
// Emits.
const emit = defineEmits<{ (e: 'update:dark', v: boolean): void }>()
</script>
<template>
<div class="ui-toggle-theme">
<ui-icon
:name="props.dark ? 'moon' : 'sun'"
@click="emit('update:dark', !props.dark)"
title="Переключить тему"
/>
</div>
</template>

View File

@ -17,3 +17,4 @@ export { default as UiForm } from './Form.vue'
export { default as UiCard } from './Card.vue'
export { default as UiTable } from './Table.vue'
export { default as UiDialog } from './Dialog.vue'
export { default as UiToggleTheme } from './ToggleTheme.vue'

View File

@ -1,7 +1,13 @@
body
@apply text-dark
// Layouts.
.layout
@apply flex flex-col h-full
@apply min-w-[320px]
min-height: 100vh
overflow: hidden
*
@apply text-base
main
@apply flex flex-col flex-1
h1
@apply text-xl md:text-2xl font-bold
@ -19,6 +25,7 @@ p
.title
@apply mb-4
// Ui.
.ui
&-btn,
&-field .input
@ -133,3 +140,6 @@ p
@apply text-dark
&-content
@apply p-3
&-toggle-theme
.ui-icon
@apply cursor-pointer

View File

@ -1,3 +1,14 @@
// Layouts.
.layout
@apply bg-light/10 text-dark
@apply dark:bg-black dark:text-light
*
@apply border-light dark:border-light/40
a
@apply text-primary
// body
// *
.ui
&-btn,
&-alert
@ -23,7 +34,7 @@
&-field
.input
@apply bg-white text-dark
@apply bg-white dark:bg-white/10 text-dark dark:text-white
&.error
.label,
.input,