|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="shot">
|
|
|
|
|
<span class="tag" :style='{color: shotColor}'></span>
|
|
|
|
|
<button class="remove" @click="emit('remove')">x</button>
|
|
|
|
|
<img :src="img">
|
|
|
|
|
<div class="meta" v-if="!edit" @dblclick="edit=true">
|
|
|
|
@ -7,9 +8,12 @@
|
|
|
|
|
<h3 class="title" >{{title}}</h3>
|
|
|
|
|
<p class="description">{{description}}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<form class="meta" v-else>
|
|
|
|
|
<form class="meta edit" v-else>
|
|
|
|
|
<input class="title" v-model="shotTitle">
|
|
|
|
|
<textarea class="description" v-model="shotDescription"></textarea>
|
|
|
|
|
<div class="colors">
|
|
|
|
|
<span class="color" @click="setColor(c)" v-for='c in colors' :style="{color: c}"></span>
|
|
|
|
|
</div>
|
|
|
|
|
<button @click.prevent="update">Confirm</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
@ -18,20 +22,29 @@
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
|
|
|
|
|
|
|
|
|
import {ref } from 'vue'
|
|
|
|
|
import {ref, watch } from 'vue'
|
|
|
|
|
import {palette} from '../composables/palette.js'
|
|
|
|
|
const {colors} = palette()
|
|
|
|
|
|
|
|
|
|
const props = defineProps(['title', 'description', 'img', 'order'])
|
|
|
|
|
const props = defineProps(['title', 'description', 'img', 'order', 'color'])
|
|
|
|
|
|
|
|
|
|
watch(props, ()=>{
|
|
|
|
|
shotColor.value = props.color
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const shotTitle = ref(props.title)
|
|
|
|
|
const shotDescription = ref(props.description)
|
|
|
|
|
|
|
|
|
|
const shotColor = ref(props.color || colors[0])
|
|
|
|
|
const emit = defineEmits(['remove', 'update'])
|
|
|
|
|
|
|
|
|
|
const edit = ref(false)
|
|
|
|
|
|
|
|
|
|
const setColor = (c) => {
|
|
|
|
|
shotColor.value = c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const update = () => {
|
|
|
|
|
emit('update', {title: shotTitle.value, description: shotDescription.value, order: props.order})
|
|
|
|
|
emit('update', {title: shotTitle.value, description: shotDescription.value, order: props.order, color: shotColor.value})
|
|
|
|
|
edit.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -42,12 +55,17 @@
|
|
|
|
|
.shot {
|
|
|
|
|
position: relative;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.shot img {
|
|
|
|
|
width: 320px;
|
|
|
|
|
height: 180px;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 10;
|
|
|
|
|
padding: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.shot .meta {
|
|
|
|
@ -56,6 +74,30 @@
|
|
|
|
|
gap: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.shot .tag {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-color: currentColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.colors {
|
|
|
|
|
display: flex;
|
|
|
|
|
height: 16px;
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.color {
|
|
|
|
|
flex: 1;
|
|
|
|
|
background-color: currentColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.colors .color {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.title, .description{
|
|
|
|
|
margin-block: 0;
|
|
|
|
|
margin-inline: 8px;
|
|
|
|
@ -66,6 +108,21 @@
|
|
|
|
|
padding-right: 1rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.meta.edit input,
|
|
|
|
|
.meta.edit textarea,
|
|
|
|
|
.meta.edit button {
|
|
|
|
|
width: auto;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.meta.edit {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
padding: 8px;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.description {
|
|
|
|
|
font-size: 0.85rem;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
@ -76,7 +133,6 @@
|
|
|
|
|
top: 0;
|
|
|
|
|
right: 4px ;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
background-color: white;
|
|
|
|
|
z-index: 100;
|
|
|
|
|
padding: 4px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
@ -95,6 +151,7 @@
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
z-index: 100;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.shot:hover .remove {
|
|
|
|
|