Skip to content

Commit 3ea3faf

Browse files
Merge branch 'main' into partners-catalog
2 parents 5a5d7fe + a39cbe2 commit 3ea3faf

File tree

4 files changed

+45
-50
lines changed

4 files changed

+45
-50
lines changed

src/hooks.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const securityheaders: Handle = async ({ event, resolve }) => {
5353
"'unsafe-eval'",
5454
'https://*.posthog.com',
5555
'https://*.plausible.io',
56+
'https://*.reo.dev',
5657
'https://plausible.io',
5758
'https://js.zi-scripts.com',
5859
'https://ws.zoominfo.com'
@@ -74,6 +75,7 @@ const securityheaders: Handle = async ({ event, resolve }) => {
7475
'https://*.sentry.io',
7576
'https://*.plausible.io',
7677
'https://plausible.io',
78+
'https://*.reo.dev',
7779
'https://js.zi-scripts.com',
7880
'https://aorta.clickagy.com',
7981
'https://hemsync.clickagy.com',

src/lib/components/blog/table-of-contents.svelte

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
<script lang="ts">
22
import type { TocItem } from '$lib/layouts/DocsArticle.svelte';
33
import { classNames } from '$lib/utils/classnames';
4+
import { fade } from 'svelte/transition';
45
56
const backToTop = () => {
67
window.scrollTo({ top: 0 });
78
};
89
10+
let isScrolled: boolean = false;
11+
12+
window.addEventListener('scroll', () => {
13+
isScrolled = !!window.scrollY;
14+
});
15+
916
export let toc: Array<TocItem> = [];
17+
export let heading: string = 'Table of Contents';
1018
</script>
1119

1220
<nav class="sticky top-32 col-span-3 mt-2 -ml-4 hidden h-[800px] flex-col gap-6 lg:flex">
13-
<span class="text-micro text-primary ps-6 uppercase tracking-tighter">Table of Contents</span>
21+
<span class="text-micro tracking-loose text-primary font-aeonik-fono ps-6 uppercase"
22+
>{heading}</span
23+
>
1424
<div class="relative">
1525
<ul
16-
class="border-smooth mask text-caption flex max-h-[600px] flex-col gap-4 overflow-scroll border-b pb-11 [scrollbar-width:none]"
26+
class="mask text-caption flex max-h-[600px] flex-col gap-4 overflow-scroll pb-11 [scrollbar-width:none]"
1727
>
1828
{#each toc as parent (parent.href)}
1929
<li
@@ -24,7 +34,7 @@
2434
{
2535
'font-medium': parent.level && parent.level === 1,
2636
'ps-6': parent.level && parent.level === 2,
27-
'pl-10': parent.level && parent.level >= 3,
37+
'ps-12': parent.level && parent.level >= 3,
2838
'before:opacity-100': parent.selected
2939
}
3040
)}
@@ -33,7 +43,7 @@
3343

3444
{#if parent.children}
3545
<ul
36-
class="border-smooth mt-11 ml-9 flex flex-col gap-7 border-b pb-11 text-xs"
46+
class="border-smooth text-caption mt-11 ml-9 flex flex-col gap-7 border-b pb-10"
3747
>
3848
{#each parent.children as child}
3949
<li
@@ -58,11 +68,15 @@
5868
</ul>
5969
</div>
6070

61-
<button
62-
class="text-primary group mt-8 flex cursor-pointer items-center gap-2 pl-7 transition-all active:scale-95"
63-
on:click={backToTop}
64-
>
65-
<span class="web-icon-arrow-up transition group-hover:-translate-y-0.5" />
66-
Back to Top
67-
</button>
71+
{#if isScrolled}
72+
<button
73+
class="text-primary group border-smooth text-caption ms-6 -mt-4 flex cursor-pointer items-center gap-2 border-t pt-10 font-medium transition-all"
74+
on:click={backToTop}
75+
out:fade
76+
in:fade
77+
>
78+
<span class="web-icon-arrow-up transition group-hover:-translate-y-0.5" />
79+
Back to Top
80+
</button>
81+
{/if}
6882
</nav>

src/lib/layouts/DocsArticle.svelte

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import { writable } from 'svelte/store';
2020
import { Feedback } from '$lib/components';
2121
import { scrollToTop } from '$lib/actions/scrollToTop';
22+
import TableOfContents from '$lib/components/blog/table-of-contents.svelte';
2223
2324
export let title: string;
2425
export let toc: Array<TocItem>;
@@ -72,45 +73,7 @@
7273
<aside class="web-references-menu ps-6">
7374
<div class="web-references-menu-content">
7475
{#if toc && toc.length > 0}
75-
<div class="flex items-center justify-between gap-4">
76-
<h5 class="web-references-menu-title text-micro uppercase">On This Page</h5>
77-
</div>
78-
<ol class="web-references-menu-list">
79-
{#each toc as parent (parent.href)}
80-
<li class="web-references-menu-item">
81-
<a
82-
href={parent.href}
83-
class="web-references-menu-link"
84-
class:is-selected={parent.selected}
85-
>
86-
{#if parent?.step}
87-
<span class="web-numeric-badge">{parent.step}</span>
88-
{/if}
89-
<span class="text-caption">{parent.title}</span>
90-
</a>
91-
{#if parent.children}
92-
<ol class="web-references-menu-list mt-4 ml-8">
93-
{#each parent.children as child}
94-
<li class="web-references-menu-item">
95-
<a
96-
href={child.href}
97-
class="web-references-menu-link"
98-
>
99-
<span class="text-caption">{child.title}</span>
100-
</a>
101-
</li>
102-
{/each}
103-
</ol>
104-
{/if}
105-
</li>
106-
{/each}
107-
</ol>
108-
<div class="border-greyscale-900/4 border-t pt-5">
109-
<button class="web-link inline-flex items-center gap-2" use:scrollToTop>
110-
<span class="web-icon-arrow-up" aria-hidden="true" />
111-
<span class="text-caption">Back to top</span>
112-
</button>
113-
</div>
76+
<TableOfContents heading="On This Page" {toc} />
11477
{/if}
11578
</div>
11679
</aside>

src/routes/+layout.svelte

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,22 @@
178178
document.body.appendChild(zi);
179179
});
180180
</script>
181+
182+
<!-- Reo.dev -->
183+
<script type="text/javascript">
184+
!(function () {
185+
var e, t, n;
186+
(e = '144fa7eaa4904e8'),
187+
(t = function () {
188+
Reo.init({ clientID: '144fa7eaa4904e8' });
189+
}),
190+
((n = document.createElement('script')).src =
191+
'https://static.reo.dev/' + e + '/reo.js'),
192+
(n.defer = !0),
193+
(n.onload = t),
194+
document.head.appendChild(n);
195+
})();
196+
</script>
181197
{/if}
182198

183199
<!-- canonical url -->

0 commit comments

Comments
 (0)