From 4108db8e9b17cdc2f50e1e5a97884827d2412f23 Mon Sep 17 00:00:00 2001 From: rmccar <42928680+rmccar@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:31:22 +0000 Subject: [PATCH] Rename table of contents files (#3424) --- src/components/back-to-top/back-to-top.dom.js | 8 ++++---- src/components/back-to-top/back-to-top.js | 2 +- src/components/table-of-contents/_macro-options.md | 14 +++++++------- src/components/table-of-contents/_macro.njk | 6 +++--- src/components/table-of-contents/_macro.spec.js | 6 +++--- .../{_toc.scss => _table-of-contents.scss} | 2 +- .../table-of-contents/table-of-contents.dom.js | 13 +++++++++++++ .../{toc.js => table-of-contents.js} | 8 ++++---- .../{toc.spec.js => table-of-contents.spec.js} | 4 ++-- src/components/table-of-contents/toc.dom.js | 13 ------------- src/components/tabs/_macro-options.md | 2 +- src/components/tabs/tabs.js | 6 +++--- src/js/main.js | 2 +- src/scss/main.scss | 2 +- 14 files changed, 44 insertions(+), 44 deletions(-) rename src/components/table-of-contents/{_toc.scss => _table-of-contents.scss} (92%) create mode 100644 src/components/table-of-contents/table-of-contents.dom.js rename src/components/table-of-contents/{toc.js => table-of-contents.js} (73%) rename src/components/table-of-contents/{toc.spec.js => table-of-contents.spec.js} (97%) delete mode 100644 src/components/table-of-contents/toc.dom.js diff --git a/src/components/back-to-top/back-to-top.dom.js b/src/components/back-to-top/back-to-top.dom.js index c01aa4fefb..a05b722487 100644 --- a/src/components/back-to-top/back-to-top.dom.js +++ b/src/components/back-to-top/back-to-top.dom.js @@ -1,11 +1,11 @@ import domready from '../../js/domready'; async function backToTop() { - const bttElement = [...document.querySelectorAll('.ons-js-back-to-top')]; + const backToTop = [...document.querySelectorAll('.ons-js-back-to-top')]; - if (bttElement) { - const Btt = (await import('./back-to-top')).default; - bttElement.forEach((btn) => new Btt(btn)); + if (backToTop) { + const BackToTop = (await import('./back-to-top')).default; + backToTop.forEach((btn) => new BackToTop(btn)); } } diff --git a/src/components/back-to-top/back-to-top.js b/src/components/back-to-top/back-to-top.js index 96c15f6303..97d465df73 100644 --- a/src/components/back-to-top/back-to-top.js +++ b/src/components/back-to-top/back-to-top.js @@ -1,4 +1,4 @@ -export default class backToTop { +export default class BackToTop { constructor(component) { this.component = component; this.content = this.component.previousElementSibling; diff --git a/src/components/table-of-contents/_macro-options.md b/src/components/table-of-contents/_macro-options.md index b2b39dcd4f..117c03a6ee 100644 --- a/src/components/table-of-contents/_macro-options.md +++ b/src/components/table-of-contents/_macro-options.md @@ -1,10 +1,10 @@ -| Name | Type | Required | Description | -| --------- | -------------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| title | string | true | A title for the component, for example, “Contents” | -| ariaLabel | string | false | Descriptive landmark ARIA label to give a screen reader user greater understanding of its purpose. Defaults to “Table of contents”. | -| skipLink | `Skip to content` [_(ref)_](/components/skip-to-content) | false | Settings for the skip to content link that allows users to avoid reading out the Table of Contents (ToC) on each page. Required for any ToC repeated on multiple pages, such as a [guide](/patterns/guide) | -| lists | array`` | true (unless `itemsList` set) | An array of [lists](#lists) for the component | -| itemsList | array`` | true (unless `lists` set) | An array of [list items](#itemslist) for the component | +| Name | Type | Required | Description | +| --------- | -------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| title | string | true | A title for the component, for example, “Contents” | +| ariaLabel | string | false | Descriptive landmark ARIA label to give a screen reader user greater understanding of its purpose. Defaults to “Table of contents”. | +| skipLink | `Skip to content` [_(ref)_](/components/skip-to-content) | false | Settings for the skip to content link that allows users to avoid reading out the table of contents on each page. Required for any table of contents repeated on multiple pages, such as a [guide](/patterns/guide) | +| lists | array`` | true (unless `itemsList` set) | An array of [lists](#lists) for the component | +| itemsList | array`` | true (unless `lists` set) | An array of [list items](#itemslist) for the component | ## List diff --git a/src/components/table-of-contents/_macro.njk b/src/components/table-of-contents/_macro.njk index 779ac6d16e..892d9ecf44 100644 --- a/src/components/table-of-contents/_macro.njk +++ b/src/components/table-of-contents/_macro.njk @@ -2,7 +2,7 @@ {% from "components/list/_macro.njk" import onsList %} {% from "components/skip-to-content/_macro.njk" import onsSkipToContent %} -