refactor(client): use css modules

This commit is contained in:
syuilo 2023-01-15 09:14:17 +09:00
parent 4ee4e70ee0
commit 9c6629d582
4 changed files with 35 additions and 35 deletions

View file

@ -1,10 +1,10 @@
<template> <template>
<MkTooltip ref="tooltip" :showing="showing" :x="x" :y="y" :max-width="340" :direction="'top'" :inner-margin="16" @closed="emit('closed')"> <MkTooltip ref="tooltip" :showing="showing" :x="x" :y="y" :max-width="340" :direction="'top'" :inner-margin="16" @closed="emit('closed')">
<div v-if="title || series" class="qpcyisrl"> <div v-if="title || series">
<div v-if="title" class="title">{{ title }}</div> <div v-if="title" :class="$style.title">{{ title }}</div>
<template v-if="series"> <template v-if="series">
<div v-for="x in series" class="series"> <div v-for="x in series">
<span class="color" :style="{ background: x.backgroundColor, borderColor: x.borderColor }"></span> <span :class="$style.color" :style="{ background: x.backgroundColor, borderColor: x.borderColor }"></span>
<span>{{ x.text }}</span> <span>{{ x.text }}</span>
</div> </div>
</template> </template>
@ -33,14 +33,12 @@ const emit = defineEmits<{
}>(); }>();
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.qpcyisrl { .title {
> .title {
margin-bottom: 4px; margin-bottom: 4px;
} }
> .series { .color {
> .color {
display: inline-block; display: inline-block;
width: 8px; width: 8px;
height: 8px; height: 8px;
@ -48,6 +46,4 @@ const emit = defineEmits<{
border-style: solid; border-style: solid;
margin-right: 8px; margin-right: 8px;
} }
}
}
</style> </style>

View file

@ -1,6 +1,12 @@
<template> <template>
<Transition :name="$store.state.animation ? 'fade' : ''" appear> <Transition
<div ref="rootEl" class="nvlagfpb" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}"> appear
:enter-active-class="$store.state.animation ? $style.transition_fade_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_fade_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_fade_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_fade_leaveTo : ''"
>
<div ref="rootEl" :class="$style.root" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}">
<MkMenu :items="items" :align="'left'" @close="$emit('closed')"/> <MkMenu :items="items" :align="'left'" @close="$emit('closed')"/>
</div> </div>
</Transition> </Transition>
@ -68,18 +74,19 @@ function onMousedown(evt: Event) {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.nvlagfpb { .transition_fade_enterActive,
position: absolute; .transition_fade_leaveActive {
}
.fade-enter-active, .fade-leave-active {
transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
transform-origin: left top; transform-origin: left top;
} }
.transition_fade_enterFrom,
.fade-enter-from, .fade-leave-to { .transition_fade_leaveTo {
opacity: 0; opacity: 0;
transform: scale(0.9); transform: scale(0.9);
} }
.root {
position: absolute;
}
</style> </style>

View file

@ -31,6 +31,3 @@ const emit = defineEmits<{
const shown = ref(!!props.initialShown); const shown = ref(!!props.initialShown);
</script> </script>
<style lang="scss" scoped>
</style>

View file

@ -1,5 +1,5 @@
<template> <template>
<div v-if="meta" class="xfbouadm" :style="{ backgroundImage: `url(${ meta.backgroundImageUrl })` }"></div> <div v-if="meta" :class="$style.root" :style="{ backgroundImage: `url(${ meta.backgroundImageUrl })` }"></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -14,8 +14,8 @@ os.api('meta', { detail: true }).then(gotMeta => {
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.xfbouadm { .root {
background-position: center; background-position: center;
background-size: cover; background-size: cover;
} }