mirror of
https://github.com/revanced/revanced-website.git
synced 2025-04-30 06:34:35 +02:00
feat: search bar clear button
This commit is contained in:
parent
94bfe7ec77
commit
7509a724b3
@ -1,20 +1,44 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let searchTerm: string;
|
export let searchTerm: string | null;
|
||||||
|
import { fade } from 'svelte/transition';
|
||||||
|
import { quintOut } from 'svelte/easing';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<img src="../icons/search.svg" alt="Search" />
|
<img src="../icons/search.svg" id="search" alt="Search" />
|
||||||
<input type="text" placeholder={title} bind:value={searchTerm} />
|
{#if searchTerm}
|
||||||
|
<img
|
||||||
|
src="../icons/close.svg"
|
||||||
|
id="clear"
|
||||||
|
alt="Close"
|
||||||
|
on:click={() => (searchTerm = null)}
|
||||||
|
on:keypress={() => (searchTerm = null)}
|
||||||
|
transition:fade|local={{ easing: quintOut, duration: 250 }}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
<input type="text" class:clear={searchTerm} placeholder={title} bind:value={searchTerm} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
img {
|
#search {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
transform: translate(60%, 60%);
|
transform: translate(60%, 60%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#clear {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
height: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
transform: translate(1060%, 60%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
padding-right: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -24,7 +48,7 @@
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--grey-five);
|
color: var(--grey-five);
|
||||||
padding-left: 2.5rem;
|
padding-left: 2.5rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
input::placeholder {
|
input::placeholder {
|
||||||
color: var(--grey-five);
|
color: var(--grey-five);
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
<script lang="ts">
|
|
||||||
export let title: string;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<div class="package-list">
|
<div class="package-list">
|
||||||
<slot />
|
<slot />
|
||||||
@ -19,7 +15,6 @@
|
|||||||
top: 70px;
|
top: 70px;
|
||||||
padding-top: calc(6rem - 70px);
|
padding-top: calc(6rem - 70px);
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.package-list {
|
.package-list {
|
||||||
@ -30,5 +25,4 @@
|
|||||||
white-space: normal;
|
white-space: normal;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
<main>
|
<main>
|
||||||
<aside in:fly={{ y: 10, easing: quintOut, duration: 750, delay: 100 }}>
|
<aside in:fly={{ y: 10, easing: quintOut, duration: 750, delay: 100 }}>
|
||||||
<TreeMenu title="Search patches...">
|
<TreeMenu title="Search patches...">
|
||||||
<Search bind:searchTerm title="Search patches..." />
|
<Search bind:searchTerm title="Search patches" />
|
||||||
<span>
|
<span>
|
||||||
{#each packages as pkg}
|
{#each packages as pkg}
|
||||||
<TreeMenuButton bind:current name={pkg} />
|
<TreeMenuButton bind:current name={pkg} />
|
||||||
|
1
static/icons/close.svg
Normal file
1
static/icons/close.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" fill="#ACC0D3"/></svg>
|
After Width: | Height: | Size: 283 B |
Loading…
x
Reference in New Issue
Block a user