summaryrefslogtreecommitdiffstats
path: root/apps/accessibility/src/components/itemPreview.vue
blob: 79f3f0494eb245a3b309f145d8d70c9de30a5d52 (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
<template>
	<div :class="{preview: true, selected: preview.id === selected}"
		 @click="selectItem">
		<div class="preview-image" :style="{backgroundImage: 'url(' + preview.img + ')'}"></div>
		<h3>{{preview.title}}</h3>
		<p>{{preview.text}}</p>
	</div>
</template>

<script>
export default {
	name: 'itemPreview',
	props: ['preview', 'selected'],
	methods: {
		selectItem() {
			this.$emit(
				'select',
				// if we clicked the already selected one: disable it
				this.preview.id === this.selected ? false : this.preview.id
			);
		}
	}
};
</script>