Add buttons on book form
This commit is contained in:
58
front/src/BigIcon.vue
Normal file
58
front/src/BigIcon.vue
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed } from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
icon: String,
|
||||||
|
legend: String
|
||||||
|
});
|
||||||
|
|
||||||
|
const hovered = ref(false)
|
||||||
|
|
||||||
|
const computedIcon = computed(() => props.icon + (hovered.value ? "Fill" : ""));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="bigiconandlegend"
|
||||||
|
@mouseover="hovered = true"
|
||||||
|
@mouseout="hovered = false"
|
||||||
|
>
|
||||||
|
<span class="bigicon" :title="props.legend">
|
||||||
|
<component :is="computedIcon"></component>
|
||||||
|
</span>
|
||||||
|
<div class="bigiconlegend">{{props.legend}}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.bigiconandlegend {
|
||||||
|
border-radius:30px;
|
||||||
|
margin:25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bigiconandlegend:hover {
|
||||||
|
transform: scale(1.01);
|
||||||
|
transition: ease-in-out 0.02s;
|
||||||
|
background-color: bulma-primary;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bigicon {
|
||||||
|
display:flex;
|
||||||
|
justify-content:center;
|
||||||
|
align-items:center;
|
||||||
|
height: 90px;
|
||||||
|
width: 200px;
|
||||||
|
font-size: 78px;
|
||||||
|
padding-top:20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bigiconlegend {
|
||||||
|
display:flex;
|
||||||
|
justify-content:center;
|
||||||
|
align-items:center;
|
||||||
|
font-size: 34px;
|
||||||
|
width: 200px;
|
||||||
|
padding-bottom:30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
import { getBook, getImagePathOrDefault, putBookUpdate } from './api.js'
|
import { getBook, getImagePathOrDefault, putBookUpdate } from './api.js'
|
||||||
import { onBeforeRouteUpdate } from 'vue-router'
|
import { onBeforeRouteUpdate } from 'vue-router'
|
||||||
import { VRating } from 'vuetify/components/VRating';
|
import { VRating } from 'vuetify/components/VRating';
|
||||||
|
import BigIcon from './BigIcon.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: String
|
id: String
|
||||||
@@ -25,10 +26,8 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="error">{{$t('bookform.error', {error: error.message})}}</div>
|
<div v-if="error">{{$t('bookform.error', {error: error.message})}}</div>
|
||||||
<div v-if="data">
|
<div v-if="data" class="columns">
|
||||||
<h3 class="title">{{data.title}}</h3>
|
<div class="column is-narrow ml-6">
|
||||||
<h3 class="subtitle">{{data.author}}</h3>
|
|
||||||
<div class="imagewithrating">
|
|
||||||
<figure class="image">
|
<figure class="image">
|
||||||
<img v-bind:src="imagePathOrDefault" v-bind:alt="data.title">
|
<img v-bind:src="imagePathOrDefault" v-bind:alt="data.title">
|
||||||
</figure>
|
</figure>
|
||||||
@@ -41,11 +40,21 @@
|
|||||||
:model-value="data.rating/2"
|
:model-value="data.rating/2"
|
||||||
@update:modelValue="onRatingUpdate"
|
@update:modelValue="onRatingUpdate"
|
||||||
active-color="bulma-body-color"
|
active-color="bulma-body-color"
|
||||||
|
class="centered"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="column">
|
||||||
|
<h3 class="title">{{data.title}}</h3>
|
||||||
|
<h3 class="subtitle">{{data.author}}</h3>
|
||||||
<p>{{data.summary}}</p>
|
<p>{{data.summary}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<div class="iconscontainer">
|
||||||
|
<BigIcon icon="BIconEye" :legend="$t('bookform.wantread')"/>
|
||||||
|
<BigIcon icon="BIconBook" :legend="$t('bookform.startread')"/>
|
||||||
|
<BigIcon icon="BIconCheckCircle" :legend="$t('bookform.read')"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -57,9 +66,17 @@ img {
|
|||||||
width:auto;
|
width:auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imagewithrating {
|
.centered {
|
||||||
vertical-align: top;
|
display:flex;
|
||||||
display: inline-block;
|
justify-content:center;
|
||||||
text-align: center;
|
align-items:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.iconscontainer {
|
||||||
|
border: solid;
|
||||||
|
border-radius: 50px;
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -41,6 +41,9 @@
|
|||||||
"wantread": "I want to read it"
|
"wantread": "I want to read it"
|
||||||
},
|
},
|
||||||
"bookform": {
|
"bookform": {
|
||||||
"error": "Error when loading book: {error}"
|
"error": "Error when loading book: {error}",
|
||||||
|
"read": "Read",
|
||||||
|
"startread": "Started",
|
||||||
|
"wantread": "Interested"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,9 @@
|
|||||||
"wantread": "Je veux le lire"
|
"wantread": "Je veux le lire"
|
||||||
},
|
},
|
||||||
"bookform": {
|
"bookform": {
|
||||||
"error": "Erreur pendant le chargement du livre: {error}"
|
"error": "Erreur pendant le chargement du livre: {error}",
|
||||||
|
"read": "Lu",
|
||||||
|
"startread": "Commencé",
|
||||||
|
"wantread": "Intéressé"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user