-
-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
v2 Table of Contents refactor (Revisited) #1832
Conversation
🦋 Changeset detectedLatest commit: aa09ac0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Mahmoud-zino I've pushed a number of improvements this afternoon, including:
I'll aim to revisit and refine a bit more tomorrow. |
@Mahmoud-zino I'm stepping out for the day, but note I just found an odd bug:
Both the original and duplicate appear to be updated - but I have no idea why it's duplicating these! I'll pick up here and investigate tomorrow unless you get to this sooner! |
also if you add me as a contributor (I don't have write access to this PR) I can help you with some typing stuff. or I can leave comments on them whichever is easier for you. |
@Mahmoud-zino done |
I'm not sure what you mean by this. When I choose any heading or refresh the page with a particular hash in place it aligns directly with the desired heading. It's only when I scroll up or down that it moves - and it's always the expected heading. Can you expand on this?
I noted in "Active on Scroll" section, there's really nothing that can be done. It's up to the page layout to determine how far you can scroll. This is in parity to the previous version, except it now allows you to tap the option and highlight it if you're already near the bottom. The moment a scroll occurs the user selection is gone. I welcome ideas on this, but I think this is as good as it's going to get.
The auto-highlight only works when a scroll is triggered. If there's no hash, then no ToC links is active by default. This is working as intended.
DONE!
DONE! |
@Mahmoud-zino I've pushed a small fix reinstating the scroll threshold of 40px. This appears to resolve the issue in Firefox where the auto-scroll section is slightly off. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a couple of adjustments for types and spelling errors. I've also including a few suggestions/questions below:
packages/skeleton/src/lib/utilities/TableOfContents/TableOfContents.svelte
Outdated
Show resolved
Hide resolved
packages/skeleton/src/lib/utilities/TableOfContents/TableOfContents.svelte
Outdated
Show resolved
Hide resolved
sites/skeleton.dev/src/routes/(inner)/utilities/table-of-contents/+page.svelte
Outdated
Show resolved
Hide resolved
sites/skeleton.dev/src/routes/(inner)/utilities/table-of-contents/+page.svelte
Outdated
Show resolved
Hide resolved
…nts/+page.svelte Co-authored-by: CokaKoala <31664583+AdrianGonz97@users.noreply.github.com>
Linked Issue
Closes #1030
Description
I've revisited the approach to implementing the table of contents feature. This now contains three parts:
tocCrawler
- action that scans/generates IDs for headings, this populates thetocStore
tocStore
- a writable store that accepts a list of heading data to generate the list of links againstTableOfContents
- a component that generates the list of links and visible UI for the pageThis includes a few other notable changes:
key
argumentChangsets
Instructions: Changesets automate our changelog. If you modify files in
/packages/skeleton
, runpnpm changeset
in the root of the monorepo, follow the prompts, then commit the markdown file. Changes that add features should beminor
while chores and bugfixes should bepatch
. Please prefix the changeset message withfeat:
,bugfix:
orchore:
.Checklist
Please read and apply all contribution requirements.
dev
branch (NEVERmaster
)docs/
,feat/
,chore/
,bugfix/
pnpm check
pnpm format
pnpm test