Files
social-media/src/views/contents/ContentEditorPage.vue
2024-10-23 13:31:18 -04:00

74 lines
1.7 KiB
Vue

<script setup>
import { ref } from 'vue';
import HTMLContentEditor from "@/views/contents/HTMLContentEditor.vue";
import QuickyContentEditor from "@/views/contents/QuickyContentEditor.vue";
// Variables réactives pour gérer l'état des éditeurs
const showQuickyEditor = ref(true); // Par défaut, Quicky Editor est affiché
const showHtmlEditor = ref(false);
// Fonction pour afficher le Quicky Editor
const toggleQuickyEditor = () => {
showQuickyEditor.value = true;
showHtmlEditor.value = false;
};
// Fonction pour afficher le HTML Editor
const toggleHtmlEditor = () => {
showHtmlEditor.value = true;
showQuickyEditor.value = false;
};
</script>
<template>
<div class="editor-container">
<div class="editor-buttons">
<!-- Boutons -->
<button @click="toggleQuickyEditor">Quicky</button>
<button @click="toggleHtmlEditor">HTML</button>
</div>
<!-- Conteneur qui s'affiche selon le bouton cliqué -->
<div v-if="showQuickyEditor" class="mt-16"> <!-- Ajouter un margin-top pour éviter le chevauchement -->
<quicky-content-editor />
</div>
<div v-if="showHtmlEditor" class="mt-16"> <!-- Ajouter un margin-top pour éviter le chevauchement -->
<HTMLContentEditor />
</div>
</div>
</template>
<style scoped>
.editor-container {
width: 1000px;
margin: 0 auto;
}
.editor-buttons {
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
z-index: 2;
background-color: white;
padding: 1rem;
border-bottom: 1px solid #ccc;
width: 100%;
text-align: center;
}
button {
padding: 0.5rem 1rem;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f5f5f5;
cursor: pointer;
margin: 0 0.5rem;
}
button:hover {
background-color: #e0e0e0;
}
</style>