🔷 add play and actions btn

This commit is contained in:
geoffrey45
2022-04-08 21:04:52 +03:00
parent 9afab33b9a
commit 24db32ae09
4 changed files with 134 additions and 26 deletions
+44 -12
View File
@@ -4,12 +4,18 @@
:playlist="props.playlist" :playlist="props.playlist"
class="p-card rounded" class="p-card rounded"
> >
<div class="drop">
<Option :color="'#48484a'" />
</div>
<div <div
class="image rounded" class="image p-image rounded shadow-sm"
:style="{ :style="{
backgroundImage: `url(${props.playlist.image})`, backgroundImage: `url(${props.playlist.image})`,
}" }"
></div> ></div>
<div class="pbtn">
<PlayBtn />
</div>
<div class="bottom"> <div class="bottom">
<div class="name ellip">{{ props.playlist.name }}</div> <div class="name ellip">{{ props.playlist.name }}</div>
<div class="count"> <div class="count">
@@ -25,33 +31,59 @@
<script setup lang="ts"> <script setup lang="ts">
import { Playlist } from "../../interfaces"; import { Playlist } from "../../interfaces";
import PlayBtn from "../shared/PlayBtn.vue";
import Option from "../shared/Option.vue";
const props = defineProps<{ const props = defineProps<{
playlist: Playlist; playlist: Playlist;
}>(); }>();
</script> </script>
<style lang="scss"> <style lang="scss">
.p-card { .p-card {
width: 100%; width: 100%;
padding: $small; padding: 0.75rem;
transition: all 0.2s ease; transition: all 0.2s ease;
background-image: linear-gradient(37deg, #000000e8, $gray);
position: relative;
.p-image {
min-width: 100%;
height: 10rem;
transition: all 0.2s ease;
}
.drop {
position: absolute;
bottom: 4rem;
right: 1.25rem;
opacity: 0;
transition: all 0.25s ease-in-out;
.drop-btn {
background-color: $gray3;
}
}
.pbtn {
position: absolute;
bottom: 4.5rem;
left: 1.25rem;
transition: all 0.25s ease-in-out;
z-index: 10;
}
&:hover { &:hover {
background-color: $accent; .drop {
.bottom > .count { transition-delay: .75s;
color: $white; opacity: 1;
transform: translate(0, -.5rem);
} }
} }
.image {
min-width: 100%;
height: 11rem;
transition: all 0.2s ease;
}
.bottom { .bottom {
margin-top: $small; margin-top: 1rem;
.name { .name {
text-transform: capitalize; text-transform: capitalize;
+74
View File
@@ -0,0 +1,74 @@
<template>
<div
class="drop-btn rounded shadow-sm"
id="option-drop"
@click="showDropdown"
>
<div
class="image drop-icon"
:class="{ clicked: clicked && src == ContextSrc.PHeader }"
></div>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { ContextSrc } from "../../composables/enums";
let elem: DOMRect;
const clicked = ref(false);
const props = defineProps<{
src?: string;
color?: string;
}>();
const emit = defineEmits<{
(e: "showDropdown", event: any): void;
}>();
onMounted(() => {
elem = document.getElementById("option-drop").getBoundingClientRect();
});
function showDropdown(e: Event) {
e.preventDefault();
e.stopImmediatePropagation();
emit("showDropdown", {
clientX: elem.left + 45,
clientY: elem.top,
});
clicked.value = true;
}
</script>
<style lang="scss">
.drop-btn {
width: 2.5rem;
height: 2.5rem;
background-color: $accent;
transition: all 0.5s ease-in-out;
cursor: pointer;
.drop-icon {
transition: all 0.25s;
padding: $small;
height: 2.5rem;
width: 2.5rem;
background-image: url("../../assets/icons/right-arrow.svg");
background-size: 1.75rem;
transform: rotate(90deg);
}
.clicked {
transform: rotate(0deg);
}
&:hover {
background-color: $green;
.image {
transform: rotate(0deg);
}
}
}
</style>
+14 -12
View File
@@ -1,22 +1,24 @@
<template> <template>
<div class="play-btn circular"> <div class="play-btn rounded shadow-sm" @click="playThis"></div>
<div class="icon"></div>
</div>
</template> </template>
<script setup lang="ts">
function playThis(e: Event) {
e.preventDefault();
e.stopImmediatePropagation();
}
</script>
<style lang="scss"> <style lang="scss">
.play-btn { .play-btn {
width: 2rem; width: 2.5rem;
height: 2rem; height: 2.5rem;
background-color: $accent; background-color: $gray3;
background-image: url("../../assets/icons/play.svg"); background-image: url("../../assets/icons/play.svg");
background-size: 1.25rem; background-size: 1.75rem;
background-position: 60%; background-position: 50% 50%;
background-repeat: no-repeat; transition: all 0.25s ease-in-out;
transition: all .25s;
&:hover { &:hover {
background-color: rgb(58, 197, 58); background-color: $accent;
transform: scale(1.1); transform: scale(1.1);
} }
} }
+1 -1
View File
@@ -55,7 +55,7 @@ function play() {
cursor: pointer; cursor: pointer;
background: linear-gradient(34deg, $accent, $red); background: linear-gradient(34deg, $accent, $red);
user-select: none; user-select: none;
transition: all 0.5s ease; transition: all 0.5s ease-in-out;
.icon { .icon {
height: 2rem; height: 2rem;