mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
focus search tab on query change
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
<template>
|
||||
<div class="filter">
|
||||
<div
|
||||
class="item"
|
||||
v-for="filter in filters"
|
||||
:key="filter"
|
||||
@click="removeFilter(filter)"
|
||||
>
|
||||
{{ filter }}<span class="cancel image"></span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ["filters"],
|
||||
setup(props, { emit }) {
|
||||
const removeFilter = (filter) => {
|
||||
emit("removeFilter", filter);
|
||||
};
|
||||
|
||||
return {
|
||||
removeFilter,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.gsearch-input .filter {
|
||||
display: flex;
|
||||
|
||||
.item {
|
||||
transition: all 0.2s ease-in-out;
|
||||
background-color: $gray3;
|
||||
height: 2.5rem;
|
||||
|
||||
&:hover {
|
||||
width: 4rem;
|
||||
|
||||
.cancel {
|
||||
position: absolute;
|
||||
right: 0.5rem;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
background-image: url(../../assets/icons/a.svg);
|
||||
background-size: 70%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,90 +0,0 @@
|
||||
<template>
|
||||
<div class="options border rounded">
|
||||
<div class="item info header">Filter by:</div>
|
||||
<div
|
||||
class="item"
|
||||
v-for="option in options"
|
||||
:key="option"
|
||||
@click="search.addFilter(option.icon)"
|
||||
>
|
||||
<div>
|
||||
<span class="icon">{{ option.icon }}</span>
|
||||
<span class="title"> {{ option.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import useSearchStore from "../../stores/gsearch";
|
||||
|
||||
const search = useSearchStore();
|
||||
|
||||
const options = [
|
||||
{
|
||||
title: "Track",
|
||||
icon: "🎵",
|
||||
},
|
||||
{
|
||||
title: "Album",
|
||||
icon: "💿",
|
||||
},
|
||||
{
|
||||
title: "Artist",
|
||||
icon: "👤",
|
||||
},
|
||||
{
|
||||
title: "Playlist",
|
||||
icon: "🎧",
|
||||
},
|
||||
{
|
||||
title: "Folder",
|
||||
icon: "📁",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.right-search .options {
|
||||
display: flex;
|
||||
margin-bottom: $small;
|
||||
|
||||
.item {
|
||||
margin: $small;
|
||||
width: 2.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
transition: all 0.2s ease-in-out;
|
||||
position: relative;
|
||||
background-color: $gray3;
|
||||
|
||||
.title {
|
||||
position: absolute;
|
||||
left: 1.5rem;
|
||||
top: 0.5rem;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 0.5rem;
|
||||
left: 0.75rem;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
width: 5.5rem;
|
||||
background-color: $gray5;
|
||||
|
||||
.title {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 5.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,15 +1,13 @@
|
||||
<template>
|
||||
<div v-show="name == selectedTab">
|
||||
<div v-show="name == s.currentTab">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { inject } from "vue";
|
||||
|
||||
import useSearchStore from "../../stores/search";
|
||||
const s = useSearchStore();
|
||||
defineProps<{
|
||||
name: string;
|
||||
}>();
|
||||
|
||||
const selectedTab = inject("currentTab");
|
||||
</script>
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
class="tab rounded"
|
||||
v-for="slot in $slots.default()"
|
||||
:key="slot.key"
|
||||
@click="currentTab = slot.props.name"
|
||||
@click="s.changeTab(slot.props.name)"
|
||||
:class="{ activetab: slot.props.name === s.currentTab }"
|
||||
>
|
||||
{{ slot.props.name }}
|
||||
</div>
|
||||
@@ -17,10 +18,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, provide } from "vue";
|
||||
import useSearchStore from "../../stores/search";
|
||||
|
||||
const currentTab = ref("Tracks");
|
||||
provide("currentTab", currentTab);
|
||||
const s = useSearchStore();
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -31,7 +31,6 @@ provide("currentTab", currentTab);
|
||||
grid-template-rows: min-content 1fr;
|
||||
|
||||
#tabheaders {
|
||||
border: solid 1px rgb(0, 68, 255);
|
||||
display: flex;
|
||||
gap: $small;
|
||||
margin: $small 0;
|
||||
@@ -40,6 +39,11 @@ provide("currentTab", currentTab);
|
||||
background-color: $gray3;
|
||||
padding: $small;
|
||||
text-transform: capitalize;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.activetab {
|
||||
background-color: $accent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user