Skip to content

Commit

Permalink
make the "search" special card fit into TabElement like the others.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Sep 17, 2023
1 parent 23b4c35 commit ee3bd96
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/lib/components/TabElement.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import Search from '$cards/Search.svelte';
import Settings from '$cards/Settings.svelte';
import Relay from '$cards/Relay.svelte';
import New from '$lib/cards/New.svelte';
export let tab: Tab;
Expand Down Expand Up @@ -111,6 +112,8 @@
<article class="font-sans mx-auto p-2 lg:max-w-4xl">
{#if tab.type === 'article'}
<Article {createChild} {replaceSelf} eventId={tab.data} {tab} />
{:else if tab.type === 'new'}
<New />
{:else if tab.type === 'find'}
<Search {createChild} {replaceSelf} query={tab.data} {tab} />
{:else if tab.type === 'welcome'}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type TabType = 'welcome' | 'find' | 'article' | 'relay' | 'settings' | 'editor';
export type TabType = 'welcome' | 'find' | 'article' | 'relay' | 'settings' | 'editor' | 'new';

export interface Tab {
id: number;
Expand Down
18 changes: 2 additions & 16 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import '../app.postcss';
import { tabs } from '$lib/state';
import { isElementInViewport, scrollTabIntoView, getParentCard } from '$lib/utils';
import { isElementInViewport, getParentCard } from '$lib/utils';
import TabElement from '$components/TabElement.svelte';
import Searchbar from '$components/Searchbar.svelte';
let dragging = false;
let startX: number;
Expand Down Expand Up @@ -69,18 +68,5 @@
<!-- this is just empty -->
<slot />

<!-- svelte-ignore a11y-no-static-element-interactions a11y-click-events-have-key-events -->
<div
id={`wikitab-special-search`}
class="
overflow-y-auto
overflow-x-hidden
mx-2 p-4 mt-2
min-w-[395px] max-w-[395px] lg:min-w-[32rem] lg:max-w-[32rem]
rounded-lg border border-slate-500 bg-slate-50
h-[calc(100vh_-_32px)]"
on:dblclick={(ev) => scrollTabIntoView(ev.currentTarget, false)}
>
<div class="p-6"><Searchbar /></div>
</div>
<TabElement tab={{ type: 'new', id: -1 }} />
</div>

0 comments on commit ee3bd96

Please sign in to comment.