Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init Back to top #585

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open

init Back to top #585

wants to merge 13 commits into from

Conversation

SenChung
Copy link
Contributor

Init Back To Top setup.

This is very much based on the work the Steve has done within The Vanilla Project.
There are a few small differences with the id of backToTop and CSS/SCSS names + the JS.

@SenChung SenChung added the enhancement New feature or request label Jan 14, 2025
@SenChung SenChung requested a review from elvishu January 14, 2025 01:53
@SenChung SenChung self-assigned this Jan 14, 2025
@elvishu elvishu requested a review from epinder-qld January 14, 2025 23:37
Copy link
Contributor

@elvishu elvishu left a comment

Choose a reason for hiding this comment

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

<a href="#" id="backToTop" class="qld__btn qld__btn--floating qld__btn--back-to-top" aria-label="Back to top">
<span>Back to top</span>
<div class="qld__widgets {{#if dynamic}}fixed{{/if}}">
<a href="#" id="backToTop" class="qld__btn qld__btn--floating qld__btn--back-to-top show" data-offset="{{offset}}" data-dynamic="{{dynamic}}" aria-label="{{text}}">
Copy link
Member

Choose a reason for hiding this comment

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

should have 'default' if 'text' is not set, i.e. 'Back to top'
offset default should be '100'.
Also why is dynamic when true == fix.
and data-dynamic default if not set is 'false'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These issues are now fixed with the latest push

@SenChung SenChung requested review from elvishu and duttonw January 17, 2025 06:17

export default {
tags: ["autodocs"],
title: "3. Components/BackToTop",
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the Back to Top to have these requirements

@@ -0,0 +1,12 @@
{{#unless hide_back_to_top}}
<div class="qld__widgets">
<a href="#" id="backToTop" class="qld__btn qld__btn--back-to-top" data-min-page-height="{{min_page_height}}" aria-label="Back to top">
Copy link
Member

Choose a reason for hiding this comment

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

does it need an id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There can only ever be one Back to Top component on a page.
So I added the id to make for simpler targeting [that said it could be removed]

<a href="#" id="backToTop" class="qld__btn qld__btn--back-to-top" data-min-page-height="{{min_page_height}}" aria-label="Back to top">
<span>Back to top</span>
{{#if has_icon}}
<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" class="qld__icon">
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to use the CSS ::after rule to add the svg icon to the page, but as I can see the we are using the image/svg-icon.svg library of svg icons. So added it this way.
That said I also see that Accordion has done it different way, and would like to do it this way too.

@SenChung SenChung requested a review from duttonw February 12, 2025 06:20
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.

3 participants