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

Add hover details component #4641

Merged
merged 13 commits into from
Dec 15, 2023
Merged

Add hover details component #4641

merged 13 commits into from
Dec 15, 2023

Conversation

mirnawong1
Copy link
Contributor

@mirnawong1 mirnawong1 commented Dec 13, 2023

as part of the epd mentorship, this pr adds a details toggle component so that we can use the following component in the markdown file to add faq-like toggles (alternative to<details></details>) and provide users a 'hover' functionality that displays the content within the toggle if you hover over the question/header. this also saves them from clicking the toggle. it does allow enable users to override the hover experience and click on the faq to expand the content.

react code to test in your local host

# Your Markdown Content

Some introductory text here...

<detailsToggle alt_header="Your Question or Header Here">
 
This is the content that will be shown or hidden when the detailsToggle component is toggled. You can write your content here, just like in regular Markdown.

</detailsToggle>

Continuing with more Markdown content...

add javascript
add css for hover
adding to the mdx them file so script runs
@mirnawong1 mirnawong1 requested a review from a team as a code owner December 13, 2023 20:21
Copy link

vercel bot commented Dec 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2023 1:27pm

@github-actions github-actions bot added Docs team Authored by the Docs team @dbt Labs size: medium This change will take up to a week to address labels Dec 13, 2023
@matthewshaver
Copy link
Contributor

Messing around in the preview, and came across behavior that might frustrate users. Once the hover is activated, there isn't a way to keep the text open. If they click the text while the hover is active, it closes the window rather than keeping it open, they then have to click again to open, but if the move the cursor away and back over, the hover will activate again.

This could frustrate users if there are links in the text they want to click on. If they hover, they see the text, then leave the hover to try and click on a link, and the text box closes. Is there a way we can set it so if they click on the headline during the hover view it will keep the text open?

Here's a loom to highlight what I mean: https://www.loom.com/share/98e46e4820a54771b6ef3150a77e17d6

@mirnawong1
Copy link
Contributor Author

i totally know what you mean. i'm actually working on trying to enable that option right now in my local so this behavior will hopefully change by tomorrow!

@mirnawong1
Copy link
Contributor Author

hey @JKarlavige , i addressed Matt's comment but it still doesn't behave the way i'd like to. i think i read i need to create a parent component because the one doesn't interact with the other potential components in the md file.

is the current solution ok for now?

@JKarlavige
Copy link
Collaborator

but it still doesn't behave the way i'd like to.

What is the ideal behavior you're looking for here? Are you looking to have all other detail toggles close when another one is opened?

It looks like your latest edits definitely improve the functionality from what @matthewshaver showed in the Loom. Matt, curious what you think of the functionality after the edits? I don't see it being an issue having the toggles remain open after hover, with the option to close them by clicking.

If good with you, i'm good with how it's behaving currently!

@mirnawong1
Copy link
Contributor Author

that's right @JKarlavige ! i was trying to make it so that if i navigate away from the selected toggle, it should close when i hover to another toggle or navigate away from the entire content box.

if you're happy with the current solution @JKarlavige and @matthewshaver - I'm happy too!

Copy link
Collaborator

@JKarlavige JKarlavige left a comment

Choose a reason for hiding this comment

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

lgtm!! :shipit:

@mirnawong1 mirnawong1 merged commit d156ffa into current Dec 15, 2023
7 checks passed
@mirnawong1 mirnawong1 deleted the add-hover-details-component branch December 15, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs team Authored by the Docs team @dbt Labs size: medium This change will take up to a week to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants