geoproject-app/src/components/editor/EditorPanel.vue

150 lines
2.9 KiB
Vue

<template>
<aside id="editor-panel">
<nav class="tabs">
<button
type="button"
class="tab"
:class="{ active: activeTab === 'document' }"
@click="activeTab = 'document'"
>
Document
</button>
<button
type="button"
class="tab"
:class="{ active: activeTab === 'code' }"
@click="activeTab = 'code'"
>
Code
</button>
<button
type="button"
class="tab"
:class="{ active: activeTab === 'contenu' }"
@click="activeTab = 'contenu'"
>
Contenu
</button>
</nav>
<button
v-if="activeTab.length > 0"
type="button"
class="close-button"
@click="activeTab = ''"
title="Fermer le panneau"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
>
<path
d="M4.83582 12L11.0429 18.2071L12.4571 16.7929L7.66424 12L12.4571 7.20712L11.0429 5.79291L4.83582 12ZM10.4857 12L16.6928 18.2071L18.107 16.7929L13.3141 12L18.107 7.20712L16.6928 5.79291L10.4857 12Z"
></path>
</svg>
</button>
<div class="tab-content" :class="{ open: activeTab.length > 0 }">
<div v-if="activeTab === 'document'" class="tab-panel">
<PageSettings />
<TextSettings />
</div>
<div v-else-if="activeTab === 'code'" class="tab-panel">
<StylesheetViewer />
</div>
<div v-else-if="activeTab === 'contenu'" class="tab-panel">
<!-- Contenu tab content -->
</div>
</div>
</aside>
</template>
<script setup>
import { inject } from 'vue';
import PageSettings from './PageSettings.vue';
import TextSettings from './TextSettings.vue';
import StylesheetViewer from '../StylesheetViewer.vue';
const activeTab = inject('activeTab');
</script>
<style lang="scss" scoped>
#editor-panel {
position: fixed;
top: 0;
left: 0;
width: var(--panel-w);
height: 100vh;
display: flex;
flex-direction: column;
z-index: 2;
pointer-events: none;
}
nav {
position: absolute;
margin: 1.5rem 0 0 2rem;
display: flex;
gap: 0.5rem;
z-index: 2;
pointer-events: all;
}
.close-button {
position: absolute;
top: 1.5rem;
right: 1rem;
z-index: 2;
width: 2rem;
height: 2rem;
padding: 0.25rem;
background: transparent;
border: none;
cursor: pointer;
color: var(--color-interface-300);
transition: color 0.2s ease;
&:hover {
color: var(--color-browngray-100);
}
svg {
width: 100%;
height: 100%;
}
}
.tab-content {
flex: 1;
overflow: hidden;
position: relative;
left: calc(var(--panel-w) * -1);
padding: 4rem 0;
background-color: var(--color-panel-bg);
box-shadow: -5px 0px 12px;
transition: left 0.3s var(--curve);
pointer-events: all;
}
.tab-content.open {
left: 0rem;
}
.tab-panel {
height: 100%;
overflow-y: auto;
overflow-x: hidden;
padding: 0 2em;
// padding-left: 1em;
}
</style>