Browse Source

Fit ToC styling to theme

master
buttercat1791 9 months ago
parent
commit
b492a33cc7
  1. 14
      src/app.css
  2. 5
      src/lib/components/publications/Publication.svelte
  3. 4
      src/lib/components/publications/TableOfContents.svelte
  4. 9
      src/lib/components/util/ArticleNav.svelte

14
src/app.css

@ -154,20 +154,6 @@
@apply text-gray-800 hover:text-primary-400 dark:text-gray-300 dark:hover:text-primary-500; @apply text-gray-800 hover:text-primary-400 dark:text-gray-300 dark:hover:text-primary-500;
} }
/* Sidebar */
aside.sidebar-leather {
@apply fixed md:sticky top-[130px] sm:top-[146px] h-[calc(100vh-130px)] sm:h-[calc(100vh-146px)] z-10;
@apply bg-primary-0 dark:bg-primary-1000 px-5 w-full sm:w-auto sm:max-w-xl;
}
aside.sidebar-leather > div {
@apply bg-primary-50 dark:bg-gray-800 h-full px-5 py-0;
}
a.sidebar-item-leather {
@apply hover:bg-primary-100 dark:hover:bg-gray-800;
}
div.skeleton-leather div { div.skeleton-leather div {
@apply bg-primary-100 dark:bg-primary-800; @apply bg-primary-100 dark:bg-primary-800;
} }

5
src/lib/components/publications/Publication.svelte

@ -37,6 +37,7 @@
let isLoading = $state<boolean>(false); let isLoading = $state<boolean>(false);
let isDone = $state<boolean>(false); let isDone = $state<boolean>(false);
let lastElementRef = $state<HTMLElement | null>(null); let lastElementRef = $state<HTMLElement | null>(null);
let activeAddress = $state<string | null>(null);
let observer: IntersectionObserver; let observer: IntersectionObserver;
@ -169,7 +170,11 @@
{#if $publicationColumnVisibility.toc} {#if $publicationColumnVisibility.toc}
<Sidebar <Sidebar
activeUrl={`#${activeAddress ?? ''}`} activeUrl={`#${activeAddress ?? ''}`}
asideClass='fixed md:sticky top-[130px] sm:top-[146px] h-[calc(100vh-130px)] sm:h-[calc(100vh-146px)] z-10 bg-primary-0 dark:bg-primary-1000 px-5 w-80 left-0 pt-4 md:!pr-16 overflow-y-auto rounded-lg border-primary-200 dark:border-primary-800'
activeClass='flex items-center p-2 bg-primary-50 dark:bg-primary-800 p-2 rounded-lg'
nonActiveClass='flex items-center p-2 hover:bg-primary-50 dark:hover:bg-primary-800 p-2 rounded-lg'
> >
<CloseButton onclick={closeToc} class='btn-leather absolute top-4 right-4 hover:bg-primary-50 dark:hover:bg-primary-800' />
<TableOfContents <TableOfContents
displayMode='sidebar' displayMode='sidebar'
rootAddress={rootAddress} rootAddress={rootAddress}

4
src/lib/components/publications/TableOfContents.svelte

@ -73,6 +73,8 @@
{/each} {/each}
</Accordion> </Accordion>
{:else} {:else}
<!-- TODO: Figure out how to style indentations. -->
<!-- TODO: Make group title fonts the same as entry title fonts. -->
<SidebarGroup> <SidebarGroup>
{#each entries as entry} {#each entries as entry}
{@const address = entry.address} {@const address = entry.address}
@ -82,12 +84,14 @@
<SidebarItem <SidebarItem
label={entry.title} label={entry.title}
href={`#${address}`} href={`#${address}`}
spanClass='px-2 text-ellipsis'
onclick={() => onSectionFocused?.(address)} onclick={() => onSectionFocused?.(address)}
/> />
{:else} {:else}
{@const childDepth = depth + 1} {@const childDepth = depth + 1}
<SidebarDropdownWrapper <SidebarDropdownWrapper
label={entry.title} label={entry.title}
btnClass='flex items-center p-2 w-full font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-primary-50 dark:text-white dark:hover:bg-primary-800'
bind:isOpen={ bind:isOpen={
() => expanded, () => expanded,
(open) => setEntryExpanded(address, open) (open) => setEntryExpanded(address, open)

9
src/lib/components/util/ArticleNav.svelte

@ -139,8 +139,13 @@
{/if} {/if}
{/if} {/if}
</div> </div>
<div class="flex flex-grow text justify-center items-center"> <div class="flex flex-col flex-grow text justify-center items-center">
<p class="max-w-[60vw] line-ellipsis"><b class="text-nowrap">{title}</b><span class="whitespace-nowrap">by {@render userBadge(pubkey, author)}</span></p> <p class="max-w-[60vw] line-ellipsis">
<b class="text-nowrap">{title}</b>
</p>
<p>
<span class="whitespace-nowrap">by {@render userBadge(pubkey, author)}</span>
</p>
</div> </div>
<div class="flex justify-end items-center space-x-2 md:min-w-52 min-w-8"> <div class="flex justify-end items-center space-x-2 md:min-w-52 min-w-8">
{#if $publicationColumnVisibility.inner} {#if $publicationColumnVisibility.inner}

Loading…
Cancel
Save