aboutsummaryrefslogtreecommitdiff
path: root/src/components/BaseLine.vue
blob: f0008f943cab39b321eeb2edbc96a7d6dae4e803 (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
<template>
<div class="bg-stone-900 text-stone-50 flex" :class="{'flex-col': vert}">
	<div v-for="p in periods" :key="p.label" :style="periodStyles(p)">
		<div :style="labelStyles">{{p.label}}</div>
	</div>
</div>
</template>

<script setup lang="ts">
import {ref, computed, PropType} from 'vue';

// Props
const props = defineProps({
	vert: {type: Boolean, required: true},
	timelineData: {type: Object as PropType<number[][]>, required: true},
});

// Time periods to represent
const periods = ref([
	{label: 'One', len: 1},
	{label: 'Two', len: 2},
	{label: 'Three', len: 1},
]);

// Styles
function periodStyles(period){
	return {
		outline: '1px solid gray',
		flexGrow: period.len,
	};
}
const labelStyles = computed(() => ({
	transform: props.vert ? 'rotate(90deg) translate(50%, 0)' : 'none',
	whiteSpace: 'nowrap',
	width: props.vert ? '40px' : 'auto',
	padding: props.vert ? '0' : '4px',
}));
</script>