mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
support using / to focus search input
- add an icon
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="right-search">
|
<div class="right-search">
|
||||||
<TabsWrapper>
|
<TabsWrapper>
|
||||||
<Tab name="Tracks" v-motion-slide-visible-left>
|
<Tab name="tracks" v-motion-slide-visible-left>
|
||||||
<TracksGrid />
|
<TracksGrid />
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab name="Albums">
|
<Tab name="albums">
|
||||||
<AlbumGrid />
|
<AlbumGrid />
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab name="Artists">
|
<Tab name="artists">
|
||||||
<ArtistGrid />
|
<ArtistGrid />
|
||||||
</Tab>
|
</Tab>
|
||||||
</TabsWrapper>
|
</TabsWrapper>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="gsearch-input">
|
<div id="gsearch-input">
|
||||||
<div class="input-loader">
|
<div id="ginner" tabindex="0">
|
||||||
|
<div class="icon image"></div>
|
||||||
<input
|
<input
|
||||||
id="search"
|
id="search"
|
||||||
class="rounded"
|
class="rounded"
|
||||||
v-model="search.query"
|
v-model="search.query"
|
||||||
placeholder="Search your library"
|
placeholder="Search your library"
|
||||||
type="text"
|
type="text"
|
||||||
|
@focus="focusThis()"
|
||||||
|
@blur="unfocusThis()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -17,10 +20,17 @@ import useSearchStore from "../../stores/search";
|
|||||||
|
|
||||||
const search = useSearchStore();
|
const search = useSearchStore();
|
||||||
|
|
||||||
|
function focusThis() {
|
||||||
|
document.getElementById("ginner").classList.add("focused");
|
||||||
|
}
|
||||||
|
|
||||||
|
function unfocusThis() {
|
||||||
|
document.getElementById("ginner").classList.remove("focused");
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.gsearch-input {
|
#gsearch-input {
|
||||||
padding: $small;
|
padding: $small;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
@@ -28,15 +38,20 @@ const search = useSearchStore();
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-loader {
|
#ginner {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 0.4rem;
|
border-radius: 0.4rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
gap: $small;
|
||||||
|
background-color: $gray4;
|
||||||
|
height: 2.25rem;
|
||||||
|
|
||||||
._loader {
|
.icon {
|
||||||
position: absolute;
|
width: 2rem;
|
||||||
top: -0.15rem;
|
background-image: url("../../assets/icons/search.svg");
|
||||||
right: 2rem;
|
background-size: 1.5rem;
|
||||||
|
margin-left: $smaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
@@ -45,16 +60,15 @@ const search = useSearchStore();
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
line-height: 2.25rem;
|
line-height: 2.25rem;
|
||||||
background-color: $black;
|
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
padding-left: 0.75rem;
|
background-color: transparent;
|
||||||
outline: 2px solid transparent;
|
outline: 2px solid transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:focus {
|
.focused {
|
||||||
outline: solid $accent;
|
outline: solid $accent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -64,11 +64,15 @@ export default function (queue: any) {
|
|||||||
if (!key_down_fired) {
|
if (!key_down_fired) {
|
||||||
if (!ctrlKey) return;
|
if (!ctrlKey) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
focusSearchBox();
|
|
||||||
|
|
||||||
key_down_fired = true;
|
key_down_fired = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "/": {{
|
||||||
|
e.preventDefault();
|
||||||
|
focusSearchBox();
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user