refactor(client): use css modules

This commit is contained in:
syuilo 2023-01-14 11:48:30 +09:00
parent 1e5d4db0a1
commit c84d86b368
1 changed files with 30 additions and 28 deletions

View File

@ -1,8 +1,14 @@
<template> <template>
<div class="mk-toast"> <div>
<Transition :name="$store.state.animation ? 'toast' : ''" appear @after-leave="emit('closed')"> <Transition
<div v-if="showing" class="body _acrylic" :style="{ zIndex }"> :enter-active-class="$store.state.animation ? $style.transition_toast_enterActive : ''"
<div class="message"> :leave-active-class="$store.state.animation ? $style.transition_toast_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_toast_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_toast_leaveTo : ''"
appear @after-leave="emit('closed')"
>
<div v-if="showing" class="_acrylic" :class="$style.root" :style="{ zIndex }">
<div style="padding: 16px 24px;">
{{ message }} {{ message }}
</div> </div>
</div> </div>
@ -32,35 +38,31 @@ onMounted(() => {
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.toast-enter-active, .toast-leave-active { .transition_toast_enterActive,
.transition_toast_leaveActive {
transition: opacity 0.3s, transform 0.3s !important; transition: opacity 0.3s, transform 0.3s !important;
} }
.toast-enter-from, .toast-leave-to { .transition_toast_enterFrom,
.transition_toast_leaveTo {
opacity: 0; opacity: 0;
transform: translateY(-100%); transform: translateY(-100%);
} }
.mk-toast { > .root {
> .body { position: fixed;
position: fixed; left: 0;
left: 0; right: 0;
right: 0; top: 0;
top: 0; margin: 0 auto;
margin: 0 auto; margin-top: 16px;
margin-top: 16px; min-width: 300px;
min-width: 300px; max-width: calc(100% - 32px);
max-width: calc(100% - 32px); width: min-content;
width: min-content; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); border-radius: 8px;
border-radius: 8px; overflow: clip;
overflow: clip; text-align: center;
text-align: center; pointer-events: none;
pointer-events: none;
> .message {
padding: 16px 24px;
}
}
} }
</style> </style>