Фикс бага и добавление анимаций

This commit is contained in:
Ilia Miheev
2026-03-22 14:05:38 +03:00
parent eec6d2d439
commit ad78917e91
3 changed files with 59 additions and 14 deletions
+8 -3
View File
@@ -16,11 +16,17 @@ console.log(props.code)
<template> <template>
<div class="code-view" v-if="show"> <div class="code-view" v-if="show">
<CustomButton @click.stop="$emit('update:show', false)">Вернуться к сохранению сгенерированного кода</CustomButton> <CustomButton
@click.stop="$emit('update:show', false)">
Вернуться к сохранению сгенерированного кода
</CustomButton>
<pre> <pre>
{{ code }} {{ code }}
</pre> </pre>
<CustomButton @click.stop="$emit('update:show', false)">Вернуться к сохранению сгенерированного кода</CustomButton> <CustomButton
@click.stop="$emit('update:show', false)">
Вернуться к сохранению сгенерированного кода
</CustomButton>
</div> </div>
</template> </template>
@@ -29,7 +35,6 @@ console.log(props.code)
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
//background-image: radial-gradient(#23aae3e2, #222222);
background-color: #222222; background-color: #222222;
overflow: auto; overflow: auto;
color: #eeeeee; color: #eeeeee;
+43 -4
View File
@@ -1,12 +1,12 @@
<template> <template>
<transition name="modal-fade"> <transition name="modal-fade">
<div class="modal-backdrop" v-if="show" @click.stop="$emit('update:show', false)"> <div class="modal-backdrop" v-if="show" @click.stop="onClose">
<div class="modal" @click.stop> <div class="modal" @click.stop>
<header :class="['modal-header', isSuccess ? 'modal-header-success' : 'modal-header-error']"> <header :class="['modal-header', isSuccess ? 'modal-header-success' : 'modal-header-error']">
<slot name="header"> <slot name="header">
<strong>Заголовок по умолчанию</strong> <strong>Заголовок по умолчанию</strong>
</slot> </slot>
<button class="modal-btn-close" @click.stop="$emit('update:show', false)" <button class="modal-btn-close" @click.stop="onClose"
aria-label="Закрыть модальное окно"> aria-label="Закрыть модальное окно">
× ×
</button> </button>
@@ -16,7 +16,7 @@
</section> </section>
<footer :class="['modal-footer', isSuccess ? 'modal-footer-success' : 'modal-footer-error']"> <footer :class="['modal-footer', isSuccess ? 'modal-footer-success' : 'modal-footer-error']">
<slot name="footer"> <slot name="footer">
<button @click.stop="$emit('update:show', false)">Закрыть</button> <button @click.stop="onClose">Закрыть</button>
</slot> </slot>
</footer> </footer>
</div> </div>
@@ -25,7 +25,13 @@
</template> </template>
<script setup> <script setup>
const props = defineProps({ import {defineEmits} from 'vue'
const emit = defineEmits({
close: null,
'update:show': false,
})
defineProps({
isSuccess: { isSuccess: {
type: Boolean, type: Boolean,
default: true, default: true,
@@ -35,6 +41,11 @@ const props = defineProps({
default: false default: false
} }
}) })
function onClose() {
emit('update:show')
emit('close')
}
</script> </script>
<style> <style>
@@ -129,4 +140,32 @@ const props = defineProps({
color: red; color: red;
background: transparent; background: transparent;
} }
/* Начало появления: ниже и прозрачный */
.modal-fade-enter-from {
opacity: 0;
transform: translateY(20px);
}
/* Конец появления: на месте и видим */
.modal-fade-enter-to {
opacity: 1;
transform: translateY(0);
}
/* Начало исчезания: на месте и видим */
.modal-fade-leave-from {
opacity: 1;
transform: translateY(0);
}
/* Конец исчезания: выше и прозрачный */
.modal-fade-leave-to {
opacity: 0;
transform: translateY(-20px);
}
/* Общие настройки анимации (скорость + плавность) */
.modal-fade-enter-active,
.modal-fade-leave-active {
transition: transform 0.7s cubic-bezier(.22,.9,.31,1), opacity 0.7s ease;
will-change: transform, opacity;
}
</style> </style>
+8 -7
View File
@@ -24,7 +24,7 @@
</nav> </nav>
</aside> </aside>
</transition> </transition>
<MyDialog isSuccess v-model:show="isModalVisible"> <MyDialog isSuccess v-model:show="isModalVisible" @close="handleOkBtn">
<template #header> <template #header>
<strong>{{ infoCard.title }}</strong> <strong>{{ infoCard.title }}</strong>
</template> </template>
@@ -34,8 +34,8 @@
<template #footer> <template #footer>
<div class="navigation-wrapper__footer"> <div class="navigation-wrapper__footer">
<custom-button :to="infoCard.hrefToCourse" title="Посмотреть на Stepik">Курс</custom-button> <custom-button :to="infoCard.hrefToCourse" title="Посмотреть на Stepik">Курс</custom-button>
<custom-button :to="infoCard.hrefToDoc" <custom-button :to="infoCard.hrefToDoc" title="Посмотреть в официальной документации">Документация
title="Посмотреть в официальной документации">Документация</custom-button> </custom-button>
<custom-button @click="handleOkBtn">ОК</custom-button> <custom-button @click="handleOkBtn">ОК</custom-button>
</div> </div>
</template> </template>
@@ -44,7 +44,7 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import {ref} from 'vue';
import MyDialog from "@/components/MyDialog.vue"; import MyDialog from "@/components/MyDialog.vue";
import CustomButton from '@/components/UI/CustomButton.vue' import CustomButton from '@/components/UI/CustomButton.vue'
@@ -56,6 +56,7 @@ function handleOkBtn() {
isModalVisible.value = false isModalVisible.value = false
isOpen.value = true isOpen.value = true
} }
const toggleMenu = () => { const toggleMenu = () => {
isOpen.value = !isOpen.value; isOpen.value = !isOpen.value;
}; };
@@ -128,7 +129,7 @@ const links = [
] ]
// Экспортируем методы, если захотим управлять меню извне // Экспортируем методы, если захотим управлять меню извне
defineExpose({ open: () => (isOpen.value = true), close: closeMenu }); defineExpose({open: () => (isOpen.value = true), close: closeMenu});
</script> </script>
<style scoped> <style scoped>
@@ -217,7 +218,7 @@ h1 {
/* Анимации появления */ /* Анимации появления */
.slide-enter-active, .slide-enter-active,
.slide-leave-active { .slide-leave-active {
transition: transform 0.3s ease; transition: transform 0.39s ease;
} }
.slide-enter-from, .slide-enter-from,
@@ -227,7 +228,7 @@ h1 {
.fade-enter-active, .fade-enter-active,
.fade-leave-active { .fade-leave-active {
transition: opacity 0.3s ease; transition: opacity 0.39s ease;
} }
.fade-enter-from, .fade-enter-from,