Skip to content

Commit 2038d8b

Browse files
committed
Freeze word navigation strip
1 parent f4063c9 commit 2038d8b

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

src/routes/lexicon/+page.svelte

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import Navbar from '$lib/components/Navbar.svelte';
1010
import WordNavigationStrip from '$lib/components/WordNavigationStrip.svelte';
1111
import config from '$lib/data/config';
12-
import { SearchIcon } from '$lib/icons';
1312
import {
1413
currentReversalLettersStore,
1514
currentReversalWordsStore,
@@ -19,15 +18,12 @@
1918
vernacularLanguageStore,
2019
vernacularWordsStore
2120
} from '$lib/data/stores/lexicon.ts';
22-
import { onMount, tick } from 'svelte';
21+
import { SearchIcon } from '$lib/icons';
2322
import { getRoute } from '$lib/navigate';
23+
import { onMount, tick } from 'svelte';
2424
25-
const {
26-
vernacularAlphabet,
27-
reversalAlphabets,
28-
reversalLanguages,
29-
reversalIndexes
30-
} = $page.data;
25+
const { vernacularAlphabet, reversalAlphabets, reversalLanguages, reversalIndexes } =
26+
$page.data;
3127
3228
const alphabets = {
3329
reversal: Object.values(reversalAlphabets[0])[0],
@@ -255,8 +251,12 @@
255251
});
256252
</script>
257253

258-
<div class="grid grid-rows-[auto,1fr] fixed bg-base-100" style="height:100vh;height:100dvh;width:100vw;">
259-
<!--<div class="flex flex-col min-h-screen max-h-screen bg-base-100">-->
254+
<div
255+
class="grid fixed bg-base-100"
256+
class:grid-rows-[auto,auto,1fr]={selectedWord}
257+
class:grid-rows-[auto,1fr]={!selectedWord}
258+
style="height:100vh;height:100dvh;width:100vw;"
259+
>
260260
<Navbar {showBackButton}>
261261
{#snippet start()}
262262
<label for="sidebar" class="navbar">
@@ -267,7 +267,7 @@
267267
{/snippet}
268268
{#snippet end()}
269269
<div class="flex flex-nowrap">
270-
<div id="extraButtons" class="pr-4">
270+
<div id="extraButtons" class:pr-4={!selectedWord}>
271271
<button
272272
class="dy-btn dy-btn-ghost dy-btn-circle"
273273
on:click={() => {
@@ -294,27 +294,33 @@
294294
/>
295295
{/if}
296296

297-
<div
298-
class="flex-1 overflow-y-auto bg-base-100 width-full"
299-
bind:this={scrollContainer}
300-
on:scroll={checkIfScrolledToBottom}
301-
>
302-
{#if selectedWord}
303-
{#if !showBackButton}
304-
{showBackButton = true}
305-
{/if}
306-
<WordNavigationStrip
307-
currentWord={selectedWord}
308-
onSelectWord={selectWord}
309-
/>
310-
<LexiconXmlView
311-
{wordIds}
312-
onSelectWord={selectWord}
313-
/>
314-
{:else if selectedLanguage === vernacularLanguage}
297+
{#if selectedWord}
298+
{#if !showBackButton}
299+
{(showBackButton = true)}
300+
{/if}
301+
<WordNavigationStrip currentWord={selectedWord} onSelectWord={selectWord} />
302+
<div
303+
class="flex-1 overflow-y-auto bg-base-100 width-full"
304+
bind:this={scrollContainer}
305+
on:scroll={checkIfScrolledToBottom}
306+
>
307+
<LexiconXmlView {wordIds} onSelectWord={selectWord} />
308+
</div>
309+
{:else if selectedLanguage === vernacularLanguage}
310+
<div
311+
class="flex-1 overflow-y-auto bg-base-100 width-full"
312+
bind:this={scrollContainer}
313+
on:scroll={checkIfScrolledToBottom}
314+
>
315315
<LexiconVernacularListView {vernacularWordsList} onSelectWord={selectWord} />
316-
{:else}
316+
</div>
317+
{:else}
318+
<div
319+
class="flex-1 overflow-y-auto bg-base-100 width-full"
320+
bind:this={scrollContainer}
321+
on:scroll={checkIfScrolledToBottom}
322+
>
317323
<LexiconReversalListView {reversalWordsList} onSelectWord={selectWord} />
318-
{/if}
319-
</div>
324+
</div>
325+
{/if}
320326
</div>

0 commit comments

Comments
 (0)