diff --git a/src/lib/components/NewsletterSignup.svelte b/src/lib/components/NewsletterSignup.svelte index 662fd8ffb..f74cc6f9d 100644 --- a/src/lib/components/NewsletterSignup.svelte +++ b/src/lib/components/NewsletterSignup.svelte @@ -34,7 +34,7 @@
-

{headingText}

+

{headingText}

{descriptionText}

diff --git a/src/lib/components/Toc.svelte b/src/lib/components/Toc.svelte index 4f8320a03..6e69bb1ed 100644 --- a/src/lib/components/Toc.svelte +++ b/src/lib/components/Toc.svelte @@ -4,17 +4,88 @@ import List from 'lucide-svelte/icons/list' import '$lib/components/Card.css' import Backdrop from '$lib/components/Backdrop.svelte' + import { onMount } from 'svelte' let desktop: boolean | undefined let open: boolean | undefined let headings: HTMLHeadingElement[] | undefined + let sidebarTop = 16 // Initial top offset in rem (below banner) + + // Track scroll to adjust sidebar position + onMount(() => { + const bannerHeight = 275 // Scroll distance in pixels for full transition (higher = slower) + const minTop = 1 // Minimum top value in rem when scrolled past banner + const maxTop = 16 // Maximum top value in rem when at page top + + function handleScroll() { + const scrollY = window.scrollY + // Calculate top value based on scroll position + // As user scrolls down, reduce the top value + const remValue = Math.max(minTop, maxTop - (scrollY / bannerHeight) * (maxTop - minTop)) + sidebarTop = remValue + } + + window.addEventListener('scroll', handleScroll, { passive: true }) + handleScroll() // Initial call + + return () => { + window.removeEventListener('scroll', handleScroll) + } + }) + + function autoScroll(node: HTMLElement) { + const observer = new MutationObserver((mutations) => { + for (const mutation of mutations) { + if (mutation.type === 'attributes' && mutation.attributeName === 'class') { + const target = mutation.target as HTMLElement + if (target.classList.contains('active')) { + target.scrollIntoView({ block: 'center', behavior: 'smooth' }) + } + } + } + }) + + observer.observe(node, { + attributes: true, + subtree: true, + attributeFilter: ['class'] + }) + + return { + destroy() { + observer.disconnect() + } + } + } + -
+ + +{#if desktop} +
+ + +

Contents

+
+
+
+{/if} + + +
:root { - --toc-active-color: var(--bg); + --toc-active-color: var(--brand); --toc-li-hover-color: var(--brand); --toc-li-color: var(--text); --toc-mobile-bg: var(--bg); - --toc-active-bg: var(--brand); + --toc-active-bg: transparent; --toc-max-height: 80vh; --toc-padding: 0em 1em 1em; --toc-z-index: 10; } + /* Desktop sidebar: fixed on left */ + .desktop-toc-wrapper { + position: fixed; + /* top is set dynamically via inline style */ + width: 220px; + max-height: calc(100vh - 3rem); /* Extend nearly to bottom of viewport */ + overflow-y: auto; + background-color: transparent; + z-index: 5; + padding: 1rem; + font-size: 0.85rem; + + /* Hide scrollbar but allow scrolling */ + scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + } + + .desktop-toc-wrapper::-webkit-scrollbar { + display: none; /* Chrome, Safari, Opera */ + } + + .desktop-toc-wrapper :global(.toc) { + background-color: transparent; + } + + .desktop-toc-wrapper :global(.toc > nav) { + background-color: transparent; + } + + .desktop-toc-wrapper :global(aside.toc > nav > ol) { + padding-left: 0; + } + + .desktop-toc-wrapper :global(aside.toc > nav > ol > li) { + margin-bottom: 0.5rem; + } + + /* Hide open button on desktop ToC */ + .desktop-toc-wrapper :global(button.toc-icon) { + display: none; + } + + /* Hide the arrows/navigation bar */ + .desktop-toc-wrapper :global(.toc-title), + .desktop-toc-wrapper :global(.toc-nav), + .desktop-toc-wrapper :global(.toc-header) { + display: none !important; + } + + /* Hide all buttons in desktop sidebar */ + .desktop-toc-wrapper :global(button) { + display: none !important; + } + + /* Remove inner scrollbar - only wrapper should scroll */ + .desktop-toc-wrapper :global(nav) { + max-height: none; + overflow: visible; + } + + /* Hide mobile wrapper on desktop */ + .hidden-on-desktop { + display: none; + } + + /* Mobile styles */ .toc-head { position: sticky; top: 0; @@ -87,6 +224,8 @@ .toc-wrapper :global(.toc > nav) { background-color: inherit; + border-radius: inherit; + box-shadow: inherit; } @media (hover: none) { @@ -99,6 +238,9 @@ .toc-wrapper :global(aside.toc > nav > ol > li:hover) { text-decoration-line: underline; } + .desktop-toc-wrapper :global(aside.toc > nav > ol > li:hover) { + text-decoration-line: underline; + } .toc-close:hover { color: var(--brand); } diff --git a/src/posts/action.md b/src/posts/action.md index 4a7e89c75..e432c82a0 100644 --- a/src/posts/action.md +++ b/src/posts/action.md @@ -41,7 +41,7 @@ Choose an activity below depending on your interests or skills. title: 'Journalist or Creator', content: ` -

If you work as a journalist or have a social media following

+

If you work as a journalist or have a social media following

  • Create content about AI dangers or PauseAI. For more information, reach out to us through any of our communication channels.
@@ -50,7 +50,7 @@ content: ` { title: 'Politician or Public Servant', content: ` -

If you are a politician or work in government

+

If you are a politician or work in government

  • Prepare for the next AI safety summit. Form coalitions with other countries to share safety information and act quickly when harms arise. Work towards a global treaty.
  • Invite (or subpoena) AI lab leaders to parliamentary/congressional hearings to give their predictions and timelines of AI disasters.
  • @@ -63,7 +63,7 @@ content: ` { title: 'LegalĀ or Policy Expert', content: ` -

    If you have experience with (international) law

    +

    If you have experience with (international) law

    • Help draft policy. Draft examples. Some frameworks.
    • Make submissions to government requests for comment on AI policy (example).
    • @@ -73,7 +73,7 @@ content: ` { title: 'Academic or Educator', content: ` -

      If you are a university professor or work in an academic institution

      +

      If you are a university professor or work in an academic institution

      • Write op-eds and articles for media outlets
      • Mentor students who are interested in this topic
      • @@ -85,7 +85,7 @@ content: ` { title: 'AI Industry Professional', content: ` -

        If you work in AI

        +

        If you work in AI

        • Don't work towards better AI: Do not work for AI companies or capabilities research. And do not spread ideas on how we can make AI systems faster or smarter.
        • Talk to your management and colleagues about the risks. Get them to take an institutional position toward mitigating risk over profit. Encourage implementation of standard risk mitigation procedures and anonymous reporting.
        • diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 72550910a..86d84f35d 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -36,7 +36,7 @@

          - (Top) + Top

          diff --git a/src/styles/styles.css b/src/styles/styles.css index a08c35d4a..b8d81163f 100644 --- a/src/styles/styles.css +++ b/src/styles/styles.css @@ -110,6 +110,7 @@ h5 { font-family: var(--font-heading); font-weight: 700; line-height: 1em; + scroll-margin-top: 3rem; } h1 {