update library mode views

This commit is contained in:
axolotle
2021-06-10 18:20:30 +02:00
parent 635df76702
commit 94d79402f9
3 changed files with 34 additions and 27 deletions
+25 -24
View File
@@ -1,9 +1,9 @@
<template> <template>
<div class="card-list"> <div class="library-list">
<div class="card-list-container"> <div class="library-list-container">
<div v-for="(parents, char) in orderedTextsDepart" :key="char"> <div v-for="(parents, char) in orderedTextsDepart" :key="char">
<h3>{{ char }}</h3> <h3>{{ char }}</h3>
<div class="text-group"> <div class="library-list-nodes-group">
<node-view <node-view
v-for="parent in parents" :key="parent.id" v-for="parent in parents" :key="parent.id"
:node="parent" :node="parent"
@@ -41,7 +41,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-list { .library-list {
overflow-y: auto; overflow-y: auto;
height: 100%; height: 100%;
@@ -50,35 +50,36 @@ export default {
line-height: 1; line-height: 1;
font-size: 16.5rem; font-size: 16.5rem;
} }
}
.text-group { &-nodes-group {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.card { .node-view {
margin-bottom: 3.4375rem; margin-bottom: 3.4375rem;
$marg: 4.6875rem; $marg: 4.6875rem;
width: 100%; width: 100%;
height: 20rem; height: 20rem;
@include media-breakpoint-only(md) { @include media-breakpoint-only(md) {
max-width: calc(50% - #{($marg / 2)}); max-width: calc(50% - #{($marg / 2)});
margin-right: $marg; margin-right: $marg;
&:nth-of-type(2n) { &:nth-of-type(2n) {
margin-right: 0; margin-right: 0;
}
} }
}
@include media-breakpoint-up(lg) { @include media-breakpoint-up(lg) {
margin-right: $marg; margin-right: $marg;
max-width: calc(33.33% - #{(($marg * 2) / 3)}); max-width: calc(33.33% - #{(($marg * 2) / 3)});
&:nth-of-type(3n) { &:nth-of-type(3n) {
margin-right: 0; margin-right: 0;
}
} }
} }
} }
} }
</style> </style>
+6
View File
@@ -15,6 +15,7 @@
<node-view <node-view
:node="texts[i]" :node="texts[i]"
mode="card" mode="card"
@open-node="onOpen(texts[i])"
/> />
</foreignObject> </foreignObject>
</g> </g>
@@ -60,6 +61,11 @@ export default {
updateSize () { updateSize () {
const { width, height } = this.$refs.svg.getBoundingClientRect() const { width, height } = this.$refs.svg.getBoundingClientRect()
Object.assign(this.$data, { width, height }) Object.assign(this.$data, { width, height })
},
onOpen (node) {
// FIXME ALSO CHECK IF PARENT
this.$emit('open-node', node.id)
} }
}, },
+3 -3
View File
@@ -1,3 +1,3 @@
export { default as CardList } from './CardList' export { default as LibraryList } from './LibraryList'
export { default as CardMap } from './CardMap' export { default as LibraryMap } from './LibraryMap'
export { default as TreeMap } from './TreeMap' export { default as LibraryTree } from './LibraryTree'