|
@@ -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">
|
|
|
|
- <text-card
|
|
|
|
- :id="parent.id"
|
|
|
|
- :children="parent.children"
|
|
|
|
- @open="openText" @close="closeText"
|
|
|
|
- />
|
|
|
|
- <div>
|
|
|
|
|
|
+ <div v-if="parents.length" class="main-texts-container">
|
|
|
|
+ <section
|
|
|
|
+ v-for="(parent, i) in parents" :key="parent.id"
|
|
|
|
+ class="main-text-container text-break"
|
|
|
|
+ :style="`--n: ${i};`"
|
|
|
|
+ >
|
|
<text-card
|
|
<text-card
|
|
- v-for="id in parent.children" :key="id"
|
|
|
|
- :id="id"
|
|
|
|
- @close="closeText(parent.id, $event)"
|
|
|
|
|
|
+ :id="parent.id"
|
|
|
|
+ :children="parent.children"
|
|
|
|
+ :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>
|