2023-02-22 19:31:12 +01:00
|
|
|
<template>
|
|
|
|
|
<div class="preview-panel">
|
2023-05-15 09:26:37 +02:00
|
|
|
<img :src="item.previewUrl || item.icon" :alt="item.name" :class="{'shadow': item.previewUrl }" @error="iconError($event)"/>
|
2023-02-23 13:16:21 +01:00
|
|
|
<p>{{ item.name }}</p>
|
2023-02-22 19:31:12 +01:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'PreviewPanel',
|
|
|
|
|
props: {
|
2023-05-15 09:26:37 +02:00
|
|
|
item: Object,
|
|
|
|
|
fallbackIcon: String
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
iconError(event) {
|
|
|
|
|
event.target.src = this.fallbackIcon;
|
|
|
|
|
}
|
2023-02-22 19:31:12 +01:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
.preview-panel {
|
|
|
|
|
padding: 0 30px;
|
2023-02-23 13:16:21 +01:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.preview-panel > img {
|
2023-03-29 20:02:26 +02:00
|
|
|
min-width: 90%;
|
2023-02-23 13:16:21 +01:00
|
|
|
max-width: 256px;
|
2023-03-29 20:02:26 +02:00
|
|
|
margin: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.shadow {
|
2023-03-31 19:47:47 +02:00
|
|
|
box-shadow: 0 2px 5px rgba(0,0,0,.2);
|
2023-02-23 13:16:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.preview-panel > p {
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 24px;
|
2023-03-29 20:02:26 +02:00
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
2023-02-22 19:31:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|