-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
130 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script lang="ts"> | ||
import { createEventDispatcher } from 'svelte'; | ||
const dispatch = createEventDispatcher(), | ||
self = $$props.href ? 'a' : 'button', | ||
handleClick = (e: MouseEvent | KeyboardEvent) => { | ||
if (e instanceof KeyboardEvent && e.key !== 'Enter') { | ||
return; | ||
} | ||
dispatch('click'); | ||
}; | ||
</script> | ||
|
||
<svelte:element | ||
this={self} | ||
href={$$props.href || undefined} | ||
class="inline-block font-code text-accent-light hover:text-dark dark:text-accent-dark dark:hover:text-light {$$props.class || | ||
''}" | ||
aria-label={$$props['aria-label'] || undefined} | ||
role="button" | ||
tabindex="0" | ||
on:click={handleClick} | ||
on:keydown={handleClick} | ||
data-sveltekit-preload-code={$$props.preload ? 'hover' : 'off'} | ||
data-sveltekit-preload-data={$$props.preload ? 'hover' : 'off'} | ||
> | ||
<slot /> | ||
</svelte:element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
svelte-app/src/components/document/content/common/summary.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
svelte-app/src/components/document/content/common/summary/heading.svelte
This file was deleted.
Oops, something went wrong.
46 changes: 9 additions & 37 deletions
46
svelte-app/src/components/document/content/common/summary/item.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,19 @@ | ||
<script lang="ts"> | ||
import BulletPoint from '$components/bullet-point.svelte'; | ||
import Hoverable from '$components/hoverable.svelte'; | ||
import type { DocumentHeadings } from '$types'; | ||
export let headings: DocumentHeadings[]; | ||
$: localHeadings = headings as (DocumentHeadings & { active: boolean })[]; | ||
</script> | ||
|
||
<div | ||
class="relative flex h-fit w-full flex-col items-start justify-start text-ellipsis {$$props.class || | ||
''}" | ||
> | ||
{#each localHeadings as heading} | ||
<Hoverable bind:hovered={heading.active}> | ||
<a href={`#${heading.key}`} class="focusOutline-sm" class:active={heading.active}> | ||
<BulletPoint /> | ||
{heading.text} | ||
</a> | ||
</Hoverable> | ||
<div class={$$props.class}> | ||
{#each headings as heading} | ||
<a | ||
href={`#${heading.key}`} | ||
class="focusOutline-sm block w-full select-none overflow-hidden text-ellipsis whitespace-nowrap rounded-sm py-2 text-base font-medium hover:text-accent-light dark:hover:text-accent-dark" | ||
> | ||
• {heading.text} | ||
</a> | ||
{#if heading.children?.length} | ||
<svelte:self headings={heading.children} class="ml-6" /> | ||
<svelte:self headings={heading.children} class="ml-5" /> | ||
{/if} | ||
{/each} | ||
</div> | ||
|
||
<style lang="scss"> | ||
a { | ||
@apply ml-3 flex w-full select-none flex-row items-center gap-1 overflow-hidden text-ellipsis whitespace-nowrap rounded-sm py-[.65rem] text-[15px] text-sm font-medium text-dark/80 transition-[color]; | ||
&.active { | ||
@apply text-dark; | ||
} | ||
} | ||
:global(.dark) { | ||
a { | ||
@apply text-light/80; | ||
&.active { | ||
@apply text-light; | ||
} | ||
} | ||
} | ||
</style> |
21 changes: 9 additions & 12 deletions
21
svelte-app/src/components/document/content/common/summary/items.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
<script lang="ts"> | ||
import { circInOut } from 'svelte/easing'; | ||
import { cubicInOut } from 'svelte/easing'; | ||
import { slide } from 'svelte/transition'; | ||
import Divider from '$components/divider.svelte'; | ||
import Item from '$components/document/content/common/summary/item.svelte'; | ||
import SummaryItem from '$components/document/content/common/summary/item.svelte'; | ||
import type { DocumentHeadings } from '$types'; | ||
export let headings: DocumentHeadings[], | ||
headingsExist = false; | ||
export let headings: DocumentHeadings[]; | ||
</script> | ||
|
||
<div | ||
class="mx-7 h-fit overflow-hidden px-1 pb-3" | ||
transition:slide={{ duration: 200 + headings.length * 10, easing: circInOut }} | ||
class="relative my-6 border-t border-dark/50 px-4 pt-4 dark:border-light/50" | ||
transition:slide={{ | ||
duration: 250 + headings.length * 10, | ||
easing: cubicInOut | ||
}} | ||
> | ||
<Divider classes="mb-3 mt-0" /> | ||
|
||
{#if headingsExist} | ||
<Item {headings} /> | ||
{/if} | ||
<SummaryItem {headings} /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.