Get search looking nice
This commit is contained in:
parent
ced1f55cdb
commit
95eab9464d
5 changed files with 51 additions and 11 deletions
22
src/app.css
22
src/app.css
|
|
@ -112,8 +112,28 @@
|
||||||
@apply overflow-hidden text-ellipsis;
|
@apply overflow-hidden text-ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-padding-x {
|
||||||
|
@apply px-4 sm:px-8 md:px-12;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-padding-t {
|
||||||
|
@apply pt-4 sm:pt-8 md:pt-12;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-padding-b {
|
||||||
|
@apply pb-4 sm:pb-8 md:pb-12;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-padding-y {
|
||||||
|
@apply content-padding-t content-padding-b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-sizing {
|
||||||
|
@apply m-auto w-full max-w-3xl;
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@apply m-auto w-full max-w-3xl p-4 sm:p-8 md:p-12;
|
@apply content-sizing content-padding-x content-padding-y;
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading {
|
.heading {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="border-top fixed bottom-0 left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
|
class="border-top fixed bottom-0 left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
|
||||||
<div class="m-auto flex max-w-md justify-between px-2">
|
<div class="flex content-padding-x content-sizing justify-between px-2">
|
||||||
<div class="flex gap-4 sm:gap-8">
|
<div class="flex gap-4 sm:gap-8">
|
||||||
<PrimaryNavItem title="Search" href="/people">
|
<PrimaryNavItem title="Search" href="/people">
|
||||||
<Avatar icon="magnifer" class="!h-10 !w-10" />
|
<Avatar icon="magnifer" class="!h-10 !w-10" />
|
||||||
|
|
|
||||||
12
src/lib/components/ContentSearch.svelte
Normal file
12
src/lib/components/ContentSearch.svelte
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<div class="col-2 h-full content-padding-t content-padding-x {$$props.class}">
|
||||||
|
<div class="z-feature">
|
||||||
|
<div class="content-sizing">
|
||||||
|
<slot name="input" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="overflow-auto pt-2 scroll-container">
|
||||||
|
<div class="content-sizing">
|
||||||
|
<slot name="content" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
import {pubkey, subscribe} from "@welshman/app"
|
import {pubkey, subscribe} from "@welshman/app"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
|
import ContentSearch from "@lib/components/ContentSearch.svelte"
|
||||||
import ChatItem from "@app/components/ChatItem.svelte"
|
import ChatItem from "@app/components/ChatItem.svelte"
|
||||||
import ChatStart from "@app/components/ChatStart.svelte"
|
import ChatStart from "@app/components/ChatStart.svelte"
|
||||||
import {chatSearch, pullConservatively} from "@app/state"
|
import {chatSearch, pullConservatively} from "@app/state"
|
||||||
|
|
@ -42,8 +43,9 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content col-2">
|
|
||||||
<div class="row-2 min-w-0 flex-grow items-center">
|
<ContentSearch class="md:hidden">
|
||||||
|
<div slot="input" class="row-2 min-w-0 flex-grow items-center">
|
||||||
<label class="input input-bordered flex flex-grow items-center gap-2">
|
<label class="input input-bordered flex flex-grow items-center gap-2">
|
||||||
<Icon icon="magnifer" />
|
<Icon icon="magnifer" />
|
||||||
<!-- svelte-ignore a11y-autofocus -->
|
<!-- svelte-ignore a11y-autofocus -->
|
||||||
|
|
@ -53,6 +55,7 @@
|
||||||
<Icon icon="add-circle" />
|
<Icon icon="add-circle" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<div slot="content" class="col-2">
|
||||||
{#each chats as { id, pubkeys, messages } (id)}
|
{#each chats as { id, pubkeys, messages } (id)}
|
||||||
<ChatItem {id} {pubkeys} {messages} class="bg-alt card2" />
|
<ChatItem {id} {pubkeys} {messages} class="bg-alt card2" />
|
||||||
{:else}
|
{:else}
|
||||||
|
|
@ -64,4 +67,5 @@
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
</ContentSearch>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
import {profileSearch} from "@welshman/app"
|
import {profileSearch} from "@welshman/app"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import Page from "@lib/components/Page.svelte"
|
import Page from "@lib/components/Page.svelte"
|
||||||
|
import ContentSearch from "@lib/components/ContentSearch.svelte"
|
||||||
import PeopleItem from "@app/components/PeopleItem.svelte"
|
import PeopleItem from "@app/components/PeopleItem.svelte"
|
||||||
import {getDefaultPubkeys} from "@app/state"
|
import {getDefaultPubkeys} from "@app/state"
|
||||||
|
|
||||||
|
|
@ -16,6 +17,7 @@
|
||||||
$: pubkeys = term ? $profileSearch.searchValues(term) : defaultPubkeys
|
$: pubkeys = term ? $profileSearch.searchValues(term) : defaultPubkeys
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
console.log(element)
|
||||||
const scroller = createScroller({
|
const scroller = createScroller({
|
||||||
element,
|
element,
|
||||||
onScroll: () => {
|
onScroll: () => {
|
||||||
|
|
@ -28,14 +30,16 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Page>
|
<Page>
|
||||||
<div class="content col-2" bind:this={element}>
|
<ContentSearch>
|
||||||
<label class="input input-bordered flex w-full items-center gap-2">
|
<label slot="input" class="input input-bordered row-2">
|
||||||
<Icon icon="magnifer" />
|
<Icon icon="magnifer" />
|
||||||
<!-- svelte-ignore a11y-autofocus -->
|
<!-- svelte-ignore a11y-autofocus -->
|
||||||
<input autofocus bind:value={term} class="grow" type="text" placeholder="Search for people..." />
|
<input autofocus bind:value={term} class="grow" type="text" placeholder="Search for people..." />
|
||||||
</label>
|
</label>
|
||||||
{#each pubkeys.slice(0, limit) as pubkey (pubkey)}
|
<div slot="content" class="col-2" bind:this={element}>
|
||||||
<PeopleItem {pubkey} />
|
{#each pubkeys.slice(0, limit) as pubkey (pubkey)}
|
||||||
{/each}
|
<PeopleItem {pubkey} />
|
||||||
</div>
|
{/each}
|
||||||
|
</div>
|
||||||
|
</ContentSearch>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue