From 1652635158495d51e23c002d0a5e74bb0a567e32 Mon Sep 17 00:00:00 2001 From: Anne-Greeth van Herwijnen Date: Fri, 14 Jun 2024 10:13:44 +0200 Subject: [PATCH] Make styling work, remove ember-anchor + updateAnchor implementation --- app/components/class-field-description.hbs | 4 +- app/components/class-field-description.js | 11 ----- app/components/ember-anchor.js | 29 ----------- app/styles/app.css | 13 +++++ app/templates/class-index.hbs | 16 ++----- app/templates/project-version.hbs | 2 +- .../project-version/classes/class.hbs | 48 ++++++++----------- app/utils/get-offset.js | 9 ---- 8 files changed, 41 insertions(+), 91 deletions(-) delete mode 100644 app/components/ember-anchor.js delete mode 100644 app/utils/get-offset.js diff --git a/app/components/class-field-description.hbs b/app/components/class-field-description.hbs index 599c3faf..450fc4f7 100644 --- a/app/components/class-field-description.hbs +++ b/app/components/class-field-description.hbs @@ -1,5 +1,5 @@
-

+

{{@field.name}} {{#if @field.params}} @@ -16,7 +16,7 @@ deprecated {{/if}} {{!-- TODO: Fix this link for a11y --}} - + {{svg-jar 'link' width='20px' height='20px'}}

diff --git a/app/components/class-field-description.js b/app/components/class-field-description.js index 3e9afe64..9df8a990 100644 --- a/app/components/class-field-description.js +++ b/app/components/class-field-description.js @@ -12,15 +12,4 @@ export default class ClassFieldDescription extends Component { this.args.field.class ); } - - /** - * Callback for updating the anchor with the field name that was clicked by a user. - * - * @method updateAnchor - * @method fieldName String The name representing the field that was clicked. - */ - @action - updateAnchor(fieldName) { - this.args.updateAnchor?.(fieldName); - } } diff --git a/app/components/ember-anchor.js b/app/components/ember-anchor.js deleted file mode 100644 index a7814999..00000000 --- a/app/components/ember-anchor.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable ember/classic-decorator-no-classic-methods */ -import AnchorComponent from 'ember-anchor/components/ember-anchor'; -import config from 'ember-api-docs/config/environment'; -import getOffset from 'ember-api-docs/utils/get-offset'; - -export default class EmberAnchor extends AnchorComponent { - // This overrides Ember Anchor to support scrolling within a fixed position element - _scrollToElemPosition() { - let elem = document.querySelector( - `[data-${this.anchorQueryParam}="${this.a}"]` - ); - - if (elem && elem.offsetHeight) { - const offsetToScroll = getOffset( - elem, - config.APP.scrollContainerSelector - ); - const scrollContainer = document.querySelector( - config.APP.scrollContainerSelector - ); - if (scrollContainer.scrollTo) { - scrollContainer.scrollTo(0, offsetToScroll); - } else { - // fallback for IE11 - scrollContainer.scrollTop = offsetToScroll; - } - } - } -} diff --git a/app/styles/app.css b/app/styles/app.css index 0c004ce5..834748e2 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -129,6 +129,19 @@ dd { color: var(--color-gray-600); } +.on-this-page-wrapper .access-checkbox-list { + display: flex; + flex-direction: column; +} + +.on-this-page-wrapper .api-index-filter { + margin-top: var(--spacing-2) +} + +.on-this-page-wrapper ul { + margin-top: 0; +} + .whoops { display: flex; justify-content: center; diff --git a/app/templates/class-index.hbs b/app/templates/class-index.hbs index 57c63ab4..749fa051 100644 --- a/app/templates/class-index.hbs +++ b/app/templates/class-index.hbs @@ -1,27 +1,19 @@ {{#each sectionData.sections as |section|}} -

{{section.title}}

{{#if section.items}} +

{{section.title}}

    {{#each section.items as |item|}}
  • - {{item.name}} - +
  • {{/each}}
- {{else}} -

No documented items

{{/if}} {{/each}}
diff --git a/app/templates/project-version.hbs b/app/templates/project-version.hbs index 396b21ba..eea4d03f 100644 --- a/app/templates/project-version.hbs +++ b/app/templates/project-version.hbs @@ -27,7 +27,7 @@ @isShowingNamespaces={{version-lt this.selectedProjectVersion.compactVersion "2.16"}} /> -
+
{{outlet}}
diff --git a/app/templates/project-version/classes/class.hbs b/app/templates/project-version/classes/class.hbs index 174cd17c..af8421d8 100644 --- a/app/templates/project-version/classes/class.hbs +++ b/app/templates/project-version/classes/class.hbs @@ -69,31 +69,26 @@ {{/if}}

{{html-safe @model.description}}

- - {{#if (or @model.methods @model.properties @model.events)}} +
+ {{#if @model.methods}} +

Methods

+ + {{/if}} + {{#if @model.properties}} +

Properties

+ + {{/if}} + {{#if @model.events}} +

Events

+ + {{/if}} + +
+
On this page
+
+{{#if (or @model.methods @model.properties @model.events)}}
- -
- Show: +

- {{outlet}}
+ {{outlet}} {{/if}} - - +
\ No newline at end of file diff --git a/app/utils/get-offset.js b/app/utils/get-offset.js deleted file mode 100644 index 1204e64e..00000000 --- a/app/utils/get-offset.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function getOffset(element, container) { - let offsetTop = element.offsetTop; - let parent = element.offsetParent; - while (parent != null && parent != container) { - offsetTop += parent.offsetTop; - parent = parent.offsetParent; - } - return offsetTop; -}