add text superposition base layout

This commit is contained in:
axolotle
2021-05-08 23:57:33 +02:00
parent 4ed63fe58d
commit bd85323e9b
5 changed files with 120 additions and 26 deletions
+2
View File
@@ -26,3 +26,5 @@ $families: (
@function setColorFromId($id) { @function setColorFromId($id) {
@return map-get($families, $id); @return map-get($families, $id);
} }
$text-card-header-height: 4rem;
+6 -11
View File
@@ -3,8 +3,11 @@
@import 'bootstrap'; @import 'bootstrap';
html, body, #app { html,
body,
#app {
height: 100%; height: 100%;
overflow: hidden;
} }
#app { #app {
@@ -13,7 +16,8 @@ html, body, #app {
} }
main { main {
height: 100%; flex: 1;
overflow-y: auto;
} }
// Layouts // Layouts
@@ -24,15 +28,6 @@ main {
height: 100%; height: 100%;
} }
.split-screen {
display: flex;
height: 100%;
& > * {
flex-basis: 50%;
}
}
.container-fill { .container-fill {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
+105 -13
View File
@@ -1,23 +1,37 @@
<template> <template>
<div class="h-100 position-relative"> <div class="library">
<!-- BACKGROUND (mode) --> <!-- BACKGROUND (mode) -->
<component :is="mode" @open="openText" /> <component :is="mode" @open="openText" />
<!-- FOREGROUND (texts) --> <!-- FOREGROUND (texts) -->
<section v-for="parent in parents" :key="parent.id" class="split-screen"> <div v-if="parents.length" class="main-texts-container">
<text-card <section
:id="parent.id" v-for="(parent, i) in parents" :key="parent.id"
:children="parent.children" class="main-text-container text-break"
@open="openText" @close="closeText" :style="`--n: ${i};`"
/> >
<div>
<text-card <text-card
v-for="id in parent.children" :key="id" :id="parent.id"
:id="id" :children="parent.children"
@close="closeText(parent.id, $event)" :class="{ 'text-blur': i !== parents.length - 1 }"
class="text-card"
@open="openText" @close="closeText"
@click.native="onMainTextClick(i)"
/> />
</div>
</section> <section class="sub-texts-container">
<text-card
v-for="(id, j) in parent.children" :key="id"
:id="id"
class="text-card text-break"
:class="{ 'text-blur': i !== parents.length - 1 || j !== parent.children.length - 1 }"
:style="`--n: ${j};`"
@close="closeText(parent.id, $event)"
@click.native="onSubTextClick(i, j)"
/>
</section>
</section>
</div>
</div> </div>
</template> </template>
@@ -81,10 +95,88 @@ export default {
texts: parents.map(parent => [parent.id, ...parent.children]) texts: parents.map(parent => [parent.id, ...parent.children])
} }
}) })
},
onMainTextClick (mainTextIndex) {
if (mainTextIndex === this.texts.length - 1) return
this.parents.push(this.parents.splice(mainTextIndex, 1)[0])
this.updateQuery(this.parents)
},
onSubTextClick (mainTextIndex, subTextIndex) {
// FIXME clean this
const children = this.parents[mainTextIndex].children
let needUpdate = false
if (subTextIndex !== children.length - 1) {
children.push(children.splice(subTextIndex, 1)[0])
needUpdate = true
}
if (mainTextIndex !== this.texts.length - 1) {
this.parents.push(this.parents.splice(mainTextIndex, 1)[0])
needUpdate = true
}
if (needUpdate) {
this.updateQuery(this.parents)
}
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.library {
height: 100%;
width: 100%;
overflow: hidden;
}
.main-texts-container {
position: relative;
top: -100%;
height: 100%;
pointer-events: none;
}
.main-text-container {
display: flex;
width: 100%;
> * {
flex-basis: 50%;
}
// &:not(:last-of-type) .sub-texts-container {
// background-color: rgba($white, .5);
// }
}
.sub-texts-container {
position: relative;
height: 100%;
}
.text-card {
pointer-events: auto;
width: 100%;
}
.text-break {
position: absolute;
height: calc(100% - (var(--n) * #{$text-card-header-height}));
top: calc(var(--n) * #{$text-card-header-height});
z-index: var(--n);
}
.text-blur::before {
content: '';
pointer-events: none;
position: absolute;
z-index: 1;
display: block;
width: 100%;
height: 100%;
background-color: rgba($white, .5);
}
</style> </style>
+6 -1
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="h-100 position-absolute overflow-auto"> <div class="card-list">
<div v-for="(parents, char) in orderedParents" :key="char"> <div v-for="(parents, char) in orderedParents" :key="char">
<h3>{{ char }}</h3> <h3>{{ char }}</h3>
<b-card-group deck> <b-card-group deck>
@@ -38,6 +38,11 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-list {
overflow: auto;
height: 100%;
}
.card-deck { .card-deck {
.card { .card {
flex-basis: auto; flex-basis: auto;
+1 -1
View File
@@ -1,5 +1,5 @@
<template> <template>
<b-overlay :show="loading" class="h-100 position-absolute"> <b-overlay :show="loading" class="h-100">
<node-map <node-map
v-if="!loading" v-if="!loading"
v-bind="mapData" v-bind="mapData"