Skip to content

Conversation

@josh-wong
Copy link
Member

@josh-wong josh-wong commented Oct 29, 2024

Description

This PR adds a tooltip feature that shows the definition of terms from our glossary.

The tooltip appears on only the first mention within the content of the doc, whether it's in a paragraph, ordered or unordered list, or table. The tooltip doesn't appear in headings, links, or code blocks.

In addition, the tooltip shows English definitions on English pages and Japanese definitions on Japanese pages.

Note

The glossary tooltip feature appears only in production environments.

Related issues and/or PRs

Changes made

  • Added Typescript files that:
    • Recognizes terms when they appear on a page.
    • Renders the definition in a tooltip for that recognized term.
  • Added a Javascript file that creates a .json file from the English and Japanese glossary.mdx docs in the folder for the latest release.
  • Added styles for the tooltip.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have updated the side navigation as necessary. N/A
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes. N/A
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

@josh-wong josh-wong added the enhancement New feature or request label Oct 29, 2024
@josh-wong josh-wong self-assigned this Oct 29, 2024
@josh-wong josh-wong changed the title Add definition tooltip feature Add glossary tooltip feature Oct 29, 2024
@josh-wong josh-wong force-pushed the add-definition-tooltip-feature branch from d6232ee to aa56164 Compare October 29, 2024 06:07
@netlify
Copy link

netlify bot commented Oct 29, 2024

Deploy Preview for staging-scalardb-docs-site canceled.

Name Link
🔨 Latest commit db31a96
🔍 Latest deploy log https://app.netlify.com/sites/staging-scalardb-docs-site/deploys/672089e893667100088ebf98

On desktop: Increase padding around definitions.
On mobile: Add styles to keep the tooltip within view on narrow screens.
To avoid confusion with the glossary tooltip, this commit clarifies the naming for the tooltip for the question mark icon in the header that contains version and edition tags.
@netlify
Copy link

netlify bot commented Jan 16, 2025

Deploy Preview for staging-scalardb-docs-site failed. Why did it fail? →

Name Link
🔨 Latest commit 897060d
🔍 Latest deploy log https://app.netlify.com/sites/staging-scalardb-docs-site/deploys/6788b27063ff1600085e07ba

@josh-wong josh-wong marked this pull request as ready for review January 16, 2025 07:34
@josh-wong josh-wong merged commit d960f1b into main Jan 16, 2025
1 of 5 checks passed
@josh-wong josh-wong deleted the add-definition-tooltip-feature branch January 16, 2025 07:35
josh-wong added a commit that referenced this pull request May 14, 2025
* Create index.tsx

Swizzle component to add glossary tooltip function.

* Add glossary tooltip function

* Add styles for glossary tooltip

* Add `scripts/generate-glossary-json.js` to build step

* Add `/static/glossary.json`

Ignore `/static/glossary.json` since we only need it when building the site in production.

* Create GlossaryInjector.tsx

* Create GlossaryTooltip.tsx

* Create generate-glossary-json.js

* Remove unnecessary ignore

* Put glossary tooltip styles in ABC order

* Refactor code to support tooltips in en-us and ja-jp

* Enable i18n

* Remove unnecessary code comments

* Fix rendering of glossary tooltip

On desktop: Increase padding around definitions.
On mobile: Add styles to keep the tooltip within view on narrow screens.

* Update naming for other tooltip style

To avoid confusion with the glossary tooltip, this commit clarifies the naming for the tooltip for the question mark icon in the header that contains version and edition tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant