aboutsummaryrefslogtreecommitdiff
path: root/src/components/ParentBarTile.vue
blob: 7e17ba6c6d06a4eb6b67154763d6ff420212cd0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<script lang="ts">
import {defineComponent, PropType} from 'vue';
import {LayoutNode} from '../lib';

export default defineComponent({
	props: {
		layoutNode: {type: Object as PropType<LayoutNode>, required: true},
		tileSz: {type: Number, required: true}, //px (length of tile edge)
	},
	computed: {
		styles(): Record<string,string> {
			return {
				border: '1px black solid',
				width: this.tileSz + 'px',
				height: this.tileSz + 'px',
				minWidth: this.tileSz + 'px',
				minHeight: this.tileSz + 'px',
				backgroundImage: 'url(\'/img/' + this.layoutNode.tolNode.name.replaceAll('\'', '\\\'') + '.png\')',
				backgroundSize: 'cover',
				borderRadius: '5px',
			};
		},
		headerStyles(): Record<string,string> {
			return {
				color: 'greenyellow',
				// For ellipsis
				overflow: 'hidden',
				textOverflow: 'ellipsis',
				whiteSpace: 'nowrap',
			};
		},
	},
});
</script>

<template>
	<div :style="styles">
		<div :style="headerStyles">{{layoutNode.tolNode.name}}</div>
	</div>
</template>