Browse Source

fix: dark

main
xingyu 2 years ago
parent
commit
9c429afec6
  1. 28
      src/components/Application/src/AppDarkModeToggle.vue
  2. 2
      src/components/Modal/src/index.less

28
src/components/Application/src/AppDarkModeToggle.vue

@ -29,14 +29,8 @@ function toggleDarkMode() {
</script> </script>
<template> <template>
<div <div v-if="getShowDarkModeToggle" :class="getClass" @click="toggleDarkMode">
v-if="getShowDarkModeToggle" :class="getClass" <div :class="`${prefixCls}-inner`" />
class="relative mr-auto h-6.5 w-12.5 flex cursor-pointer items-center justify-between rounded-4.5 bg-black px-1.5"
@click="toggleDarkMode"
>
<div
class="absolute z-1 h-4.5 w-4.5 rounded-1/2 bg-white will-change-transform"
/>
<SvgIcon size="14" name="sun" /> <SvgIcon size="14" name="sun" />
<SvgIcon size="14" name="moon" /> <SvgIcon size="14" name="moon" />
</div> </div>
@ -52,11 +46,29 @@ html[data-theme='dark'] {
} }
.@{prefix-cls} { .@{prefix-cls} {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
width: 50px;
height: 26px;
padding: 0 6px;
margin-left: auto;
cursor: pointer;
background-color: #151515;
border-radius: 30px;
&-inner { &-inner {
position: absolute;
z-index: 1;
width: 18px;
height: 18px;
background-color: #fff;
border-radius: 50%;
transition: transition:
transform 0.5s, transform 0.5s,
background-color 0.5s; background-color 0.5s;
will-change: transform;
} }
&--dark { &--dark {

2
src/components/Modal/src/index.less

@ -70,7 +70,7 @@
&-close { &-close {
width: auto !important; width: auto !important;
font-weight: normal; font-weight: normal;
background: rgb(255 255 255/ 0%) !important; background: transparent !important;
outline: none; outline: none;
} }