mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Make search bar more interactive
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
| "ellipsis"
|
||||
| "fork"
|
||||
| "gear"
|
||||
| "magnifying-glass"
|
||||
| "moon"
|
||||
| "sun"
|
||||
| "twitter";
|
||||
@@ -297,6 +298,18 @@
|
||||
1.8701-0.84393 3.4204-0.22929 4.6486 0.6925 1.3838 2.004 2.4102 3.1211 3.0036
|
||||
0.15696 0.08337 0.23697 0.26295 0.19401 0.43534-0.042953 0.17246-0.19784
|
||||
0.29353-0.37557 0.29353z" />
|
||||
{:else if name === "magnifying-glass"}
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M11 6.5C8.51472 6.5 6.5
|
||||
8.51472 6.5 11C6.5 13.4853 8.51472 15.5 11 15.5C13.4853 15.5 15.5 13.4853
|
||||
15.5 11C15.5 8.51472 13.4853 6.5 11 6.5ZM5.5 11C5.5 7.96243 7.96243 5.5 11
|
||||
5.5C14.0376 5.5 16.5 7.96243 16.5 11C16.5 12.3387 16.0217 13.5658 15.2266
|
||||
14.5195L19.3536 18.6464C19.5488 18.8417 19.5488 19.1583 19.3536
|
||||
19.3536C19.1583 19.5488 18.8417 19.5488 18.6464 19.3536L14.5195
|
||||
15.2266C13.5658 16.0217 12.3387 16.5 11 16.5C7.96243 16.5 5.5 14.0376 5.5
|
||||
11Z" />
|
||||
{:else}
|
||||
{unreachable(name)}
|
||||
{/if}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
}>();
|
||||
|
||||
let rightContainerWidth: number;
|
||||
let leftContainerWidth: number;
|
||||
let inputElement: HTMLInputElement | undefined = undefined;
|
||||
|
||||
onMount(() => {
|
||||
@@ -84,6 +85,18 @@
|
||||
.dashed:focus {
|
||||
background: var(--color-background-1);
|
||||
}
|
||||
.left-container {
|
||||
color: var(--color-secondary);
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: var(--button-regular-height);
|
||||
padding-right: 0.5rem;
|
||||
padding-left: 0.5rem;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.right-container {
|
||||
color: var(--color-secondary);
|
||||
position: absolute;
|
||||
@@ -120,9 +133,18 @@
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="validation-wrapper">
|
||||
<div class="left-container" bind:clientWidth={leftContainerWidth}>
|
||||
{#if $$slots.left}
|
||||
<slot name="left" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<input
|
||||
class:regular={variant === "regular"}
|
||||
class:dashed={variant === "dashed"}
|
||||
style:padding-left={leftContainerWidth
|
||||
? `${leftContainerWidth}px`
|
||||
: "auto"}
|
||||
style:padding-right={rightContainerWidth
|
||||
? `${rightContainerWidth}px`
|
||||
: "auto"}
|
||||
@@ -133,6 +155,8 @@
|
||||
{disabled}
|
||||
bind:value
|
||||
on:input
|
||||
on:focus
|
||||
on:blur
|
||||
on:keydown|stopPropagation={handleKeydown}
|
||||
on:click
|
||||
on:change />
|
||||
|
||||
Reference in New Issue
Block a user