aboutsummaryrefslogtreecommitdiff
path: root/src/components/ParentBar.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-03-23 15:32:44 +1100
committerTerry Truong <terry06890@gmail.com>2022-03-23 15:32:44 +1100
commit96a4967d775a60beb5937e1ddee53ae35b4bbec0 (patch)
tree3fe8aba9f2c9527e8615e5a02a5bbad734a9d76d /src/components/ParentBar.vue
parent82ab31777a7cc02461f0b23f9d9550a2baf71f73 (diff)
Add basic ParentBar and ParentBarTile components
Diffstat (limited to 'src/components/ParentBar.vue')
-rw-r--r--src/components/ParentBar.vue52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/components/ParentBar.vue b/src/components/ParentBar.vue
new file mode 100644
index 0000000..cee8bea
--- /dev/null
+++ b/src/components/ParentBar.vue
@@ -0,0 +1,52 @@
+<script lang="ts">
+import {defineComponent, PropType} from 'vue';
+import {LayoutNode} from '../lib';
+import ParentBarTile from './ParentBarTile.vue'
+
+export default defineComponent({
+ props: {
+ pos: {type: Array as unknown as PropType<[number,number]>, required: true},
+ dims: {type: Array as unknown as PropType<[number,number]>, required: true},
+ nodes: {type: Array as PropType<LayoutNode[]>, required: true},
+ },
+ data(){
+ return {
+ tileMargin: 5, //px (gap between separated-parent tiles)
+ };
+ },
+ computed: {
+ wideArea(){
+ return this.dims[0] >= this.dims[1];
+ },
+ tileSz(){
+ return (this.wideArea ? this.dims[1] : this.dims[0]) - (this.tileMargin * 2);
+ },
+ styles(): Record<string,string> {
+ return {
+ position: 'absolute',
+ left: this.pos[0] + 'px',
+ top: this.pos[1] + 'px',
+ width: this.dims[0] + 'px',
+ height: this.dims[1] + 'px',
+ overflowX: this.wideArea ? 'auto' : 'hidden',
+ overflowY: this.wideArea ? 'hidden' : 'auto',
+ display: 'flex',
+ flexDirection: this.wideArea ? 'row' : 'column',
+ gap: this.tileMargin + 'px',
+ padding: this.tileMargin + 'px',
+ backgroundColor: 'gray',
+ };
+ },
+ },
+ components: {
+ ParentBarTile,
+ },
+});
+</script>
+
+<template>
+<div :style="styles">
+ <parent-bar-tile v-for="node in nodes" :key="node.tolNode.name"
+ :layoutNode="node" :tileSz="tileSz"/>
+</div>
+</template>