beautiful buttons + selector + images

This commit is contained in:
Theophyl Hoguet committed 2023-03-15 02:29:16 +01:00
1 parent f896de9041
commit af1dfe275f
4 files changed
+167 -25

No files matched your search

+2 -2
View File
@@ -113,7 +113,7 @@ ul>li {
} }
.active { .active {
background-color: #09c7aa; background-color: #646cff;
} }
.active>a { .active>a {
@@ -122,7 +122,7 @@ ul>li {
a { a {
color: rgb(172, 165, 154); color: rgb(172, 165, 154);
text-decoration-color: initial; text-decoration: none;
font-family: "Aeonik", sans-serif; font-family: "Aeonik", sans-serif;
} }
+10
View File
@@ -38,6 +38,16 @@ export default defineComponent({
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin: 5px;
padding: 0.5rem;
background-color: #1a1a1a;
color: white;
border-radius: 8px;
border: 1px solid transparent;
}
.image:hover {
border-color: #646cff;
} }
label { label {
+131 -9
View File
@@ -13,13 +13,15 @@ export default defineComponent({
props: { props: {
images: { images: {
type: Map<number, ImageType>, type: Map<number, ImageType>,
required: true required: true,
} }
}, },
data() { data() {
return { return {
imageSelectedId: 0 as number, imageSelectedId: -1 as number,
sure: false as boolean sure: false as boolean,
timer: null as ReturnType<typeof setTimeout> | null,
open: false as boolean,
} }
}, },
mounted() { mounted() {
@@ -39,25 +41,140 @@ export default defineComponent({
this.$emit('delete', this.imageSelectedId); this.$emit('delete', this.imageSelectedId);
else else
this.sure = true; this.sure = true;
},
startTimer() {
if (this.timer !== null) {
clearTimeout(this.timer);
this.timer = null;
}
this.timer = setTimeout(() => {
location.href = "/images/" + this.imageSelectedId;
}, 2500);
},
clearTimer() {
if (this.timer !== null) {
clearTimeout(this.timer);
this.timer = null;
}
} }
} }
}) })
</script> </script>
<template> <template>
<div class="flex" v-if="images.keys != null"> <div class="flex" v-if="images.keys != null">
<div> <Image @mouseleave="clearTimer()" @mouseenter="startTimer()" class="home"
v-if="imageSelectedId !== undefined && imageSelectedId !== -1" :id="imageSelectedId">
</Image>
<div class="selector">
<label>Selectioner une image: </label> <label>Selectioner une image: </label>
<select v-model="imageSelectedId" style="width: min-content;margin: 15px;"> <div class="custom-select" :tabindex="imageSelectedId" @blur="open = false">
<option v-for="[id, image] in images" :key="id" :value="id">{{ image.name }}</option> <div class="selected" :class="{ open: open }" @click="open = !open">
</select> <span>{{ images.get(imageSelectedId)?.name }}</span>
<button @mouseleave="sure = false" @click="confirmDelete()" :class="sure ? 'confirm' : ''"> </div>
<div class="items" :class="{ selectHide: !open }">
<div v-for="[id, image] of images" :key="id" @click="imageSelectedId = image.id; open = false;">
<span>{{ image.name }}</span>
</div>
</div>
</div>
<button class="button" @mouseleave="sure = false" @click="confirmDelete()" :class="sure ? 'confirm' : ''">
{{ sure ? "Confirmer" : "Supprimer" }}</button> {{ sure ? "Confirmer" : "Supprimer" }}</button>
</div> </div>
<Image class="home" v-if="imageSelectedId !== undefined" :id="imageSelectedId"></Image>
</div> </div>
<h1 v-else>Aucune image trouvée</h1> <h1 v-else>Aucune image trouvée</h1>
</template> </template>
<style scoped> <style scoped>
/* SELECT */
.custom-select {
width: 100%;
text-align: left;
outline: none;
height: 47px;
line-height: 47px;
}
.custom-select .selected {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #1a1a1a;
border-radius: 6px;
/* border: 1px solid #666666; */
color: #fff;
padding-left: 1em;
cursor: pointer;
user-select: none;
border: 1px solid transparent;
}
.custom-select .selected:hover {
border-color: #646cff;
}
.custom-select span {
padding-right: 1rem;
}
.custom-select .selected.open {
border: 1px solid #646cff;
border-radius: 6px 6px 0px 0px;
}
.custom-select .selected:after {
content: "";
margin-right: 15px;
margin-top: 5px;
border: 5px solid transparent;
border-color: #fff transparent transparent transparent;
}
.custom-select .items {
color: #fff;
border-radius: 0px 0px 6px 6px;
overflow: hidden;
border-right: 1px solid #646cff;
border-left: 1px solid #646cff;
border-bottom: 1px solid #646cff;
background-color: #1a1a1a;
}
.custom-select .items div {
color: #fff;
padding-left: 1em;
cursor: pointer;
user-select: none;
}
.custom-select .items div:hover {
background-color: #646cff;
}
.selectHide {
display: none;
}
/* FIN SELECT */
html {
overflow: hidden;
}
.selector {
margin-bottom: 5%;
display: flex;
flex-direction: row;
align-content: center;
justify-content: center;
gap: 1em;
}
.selector label {
display: flex;
align-items: center;
flex-shrink: 0;
}
.flex { .flex {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -78,4 +195,9 @@ label {
max-width: 60%; max-width: 60%;
max-height: 60vh; max-height: 60vh;
} }
.home img:hover {
transform: scale(2);
transition: transform 3s;
}
</style> </style>
+24 -14
View File
@@ -108,9 +108,10 @@ export default defineComponent({
</div> </div>
<h2 v-if="file !== null && file.length !== 0">Preview :</h2> <h2 v-if="file !== null && file.length !== 0">Preview :</h2>
<div class="previewBox"> <div class="previewBox">
<label v-for="(f, id) in (file as FileList)" :key="id" class="imageLabel">{{ (f as File).name }}: <div class="imagePreview" v-for="(f, id) in (file as FileList)" :key="id">
<label>{{ (f as File).name }}</label>
<img :id="'preview-' + id" /> <img :id="'preview-' + id" />
</label> </div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
@@ -144,29 +145,19 @@ h2 {
.filename { .filename {
background-color: white; background-color: white;
color: black; color: black;
border: 1px solid rgb(255, 0, 98); border: 1px solid #1a1a1a;
border-radius: 0 8px 8px 0; border-radius: 0 8px 8px 0;
} }
#labelInput { #labelInput {
border-radius: 8px 0 0 8px; border-radius: 8px 0 0 8px;
background-color: rgb(255, 0, 98); background-color: #1a1a1a;
} }
.inputform:hover label { .inputform:hover label {
border-color: #646cff; border-color: #646cff;
} }
.imageLabel {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
max-width: 33%;
height: 33vh;
margin: 5px;
}
.previewBox { .previewBox {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@@ -175,6 +166,25 @@ h2 {
flex-wrap: wrap; flex-wrap: wrap;
} }
.imagePreview {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
max-width: 33%;
height: 33vh;
margin: 5px;
padding: 0.5rem;
background-color: #1a1a1a;
color: white;
border-radius: 8px;
border: 1px solid transparent;
}
.imagePreview:hover {
border-color: #646cff;
}
.error { .error {
color: red; color: red;
font-weight: bold; font-weight: bold;