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", "name": "axp-ui",
"descriiption": "My helper ui lib", "descriiption": "My helper ui lib",
"version": "1.6.1", "version": "1.6.2",
"homepage": "https://antoxahub.ru/antoxa/axp-ui", "homepage": "https://antoxahub.ru/antoxa/axp-ui",
"repository": { "repository": {
"type": "git", "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 UiCard } from './Card.vue'
export { default as UiTable } from './Table.vue' export { default as UiTable } from './Table.vue'
export { default as UiDialog } from './Dialog.vue' export { default as UiDialog } from './Dialog.vue'
export { default as UiToggleTheme } from './ToggleTheme.vue'

View File

@ -1,7 +1,13 @@
body // Layouts.
@apply text-dark .layout
@apply flex flex-col h-full
@apply min-w-[320px]
min-height: 100vh
overflow: hidden
* *
@apply text-base @apply text-base
main
@apply flex flex-col flex-1
h1 h1
@apply text-xl md:text-2xl font-bold @apply text-xl md:text-2xl font-bold
@ -19,6 +25,7 @@ p
.title .title
@apply mb-4 @apply mb-4
// Ui.
.ui .ui
&-btn, &-btn,
&-field .input &-field .input
@ -133,3 +140,6 @@ p
@apply text-dark @apply text-dark
&-content &-content
@apply p-3 @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 .ui
&-btn, &-btn,
&-alert &-alert
@ -23,7 +34,7 @@
&-field &-field
.input .input
@apply bg-white text-dark @apply bg-white dark:bg-white/10 text-dark dark:text-white
&.error &.error
.label, .label,
.input, .input,