Skip to content

Feature/Table of Contents#48

Merged
leonardoAnjos16 merged 18 commits into
mainfrom
feature/table-of-contents
Jun 22, 2022
Merged

Feature/Table of Contents#48
leonardoAnjos16 merged 18 commits into
mainfrom
feature/table-of-contents

Conversation

@leonardoAnjos16

@leonardoAnjos16 leonardoAnjos16 commented Jun 14, 2022

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

To add a Table of Contents to the API Guide documentation pages.

Documented here

What problem is this solving?

The lack of a component for rendering a Table of Contents. The Table of Contents helps the reader keep track of where they are in the article and navigate to specific sections faster.

How should this be manually tested?

Go to this page and try scrolling up and down. The Table of Contents should update to show in which part of the article you're at. Try clicking in the links inside the Table of Contents, you should be taken to the corresponding section of the documentation and the Table of Contents should update accordingly (do keep in mind that clicking the link to a heading that is too close to another one may have the effect of making the other heading show as active in the Table of Contents).

Screenshots or example usage

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires change to documentation, which has been updated accordingly.

@netlify

netlify Bot commented Jun 14, 2022

Copy link
Copy Markdown

Deploy Preview for elated-hoover-5c29bf ready!

Name Link
🔨 Latest commit 7c68d91
🔍 Latest deploy log https://app.netlify.com/sites/elated-hoover-5c29bf/deploys/62b335c281ceba0008858cf2
😎 Deploy Preview https://deploy-preview-48--elated-hoover-5c29bf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@amandascm amandascm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✨ really nice docs too

Some details that caught my attention:

  • The TOC is showing some subtopics of Billing Options API Guide with ':' character. It made me question if it should be filtered out of the headers that are shown by the table.
    image

  • Now about the following quote, also in the Billing Options API Guide, if I am anywhere on the page below the 'plans array:' subtopic and click on the 'support object:' at the TOC it always redirects me correctly to the desired topic, but it shows the 'plans array:' as active item. As it looks more like a pattern or like there is a prioritization of the later content in the TOC topics order, I thought it was an important observation to register here.

    do keep in mind that clicking the link to a heading that is too close to another one may have the effect of making the other heading show as active in the Table of Contents

    toc-review.mp4

@RobsonOlv RobsonOlv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@leonardoAnjos16

Copy link
Copy Markdown
Contributor Author

LGTM ✨ really nice docs too

Some details that caught my attention:

  • The TOC is showing some subtopics of Billing Options API Guide with ':' character. It made me question if it should be filtered out of the headers that are shown by the table.
    image

@amandascm, I just talked to João and he told me to remove the ':' character. He also said that we can figure out later which other special characters we'll need to remove. So, for now, I changed the code to remove only ':' from the titles.

  • Now about the following quote, also in the Billing Options API Guide, if I am anywhere on the page below the 'plans array:' subtopic and click on the 'support object:' at the TOC it always redirects me correctly to the desired topic, but it shows the 'plans array:' as active item. As it looks more like a pattern or like there is a prioritization of the later content in the TOC topics order, I thought it was an important observation to register here.

    do keep in mind that clicking the link to a heading that is too close to another one may have the effect of making the other heading show as active in the Table of Contents

    toc-review.mp4
    

The reason that happens is because two things happen when you click one of the titles inside the table of contents, not necessarily in that order:

  • The onClick event of the link is triggered and it updates the active item of the TOC
  • The Intersection Observer API may detect that an element (other than the one clicked) just became 100% visible and it triggers a function to update the active item of the TOC

I think that the second thing happens after the first most oftenly because the Intersection Observer API detects those changes after every some amount of time, while the first function is called almost instantly.

That being said, one solution to avoid that problem is making the top scroll padding (how far from the top of the page a heading must be shown if clicked) match the bottom root margin (how far from the bottom of the page a heading must be to be considered 100% visible) attribute of the React Intersection Observer (by match, I mean those values must sum up to 100vh). The problem with that approach is that we have to balance those attributes and we may end up taking too long to say a heading is visible or showing a heading too far from the top of the page when the user clicks it. For now, I used 20vh of top scroll padding and 80vh of bottom root margin. Can you review it again, please?

@amandascm amandascm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀 💯

@JoaoMontenegr0 JoaoMontenegr0 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfeito!
Se puder, testa com mais de um grande tópico contendo também subtópicos, isso nos ajudará a ver possíveis problemas de design. Se for possível, adiciona uma animação semelhante a do Contributors para não ficar uma transição bruta entre o grande tópico e a exibição de seus subtópicos.

@JosueFidelis JosueFidelis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔝

@Meyrillan Meyrillan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✨

@melissafalcao melissafalcao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@JosueFidelis JosueFidelis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔝

@leonardoAnjos16
leonardoAnjos16 force-pushed the feature/table-of-contents branch from d9e8fc9 to 7c68d91 Compare June 22, 2022 15:31
@leonardoAnjos16
leonardoAnjos16 merged commit 3d3f786 into main Jun 22, 2022
@leonardoAnjos16
leonardoAnjos16 deleted the feature/table-of-contents branch June 22, 2022 15:35

@Meyrillan Meyrillan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

julia-rabello added a commit that referenced this pull request Jul 13, 2026
The previous bump pointed the submodule at 5f92864, which is 7 commits
behind master and predates both the callout icon source fix (#48) and
the dist/docs rebuild (#49). Updated to master's HEAD (85adf70) so API
reference callouts actually render the fixed icons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-minor Minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants