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

update expandable component #6920

Merged
merged 5 commits into from
Feb 20, 2025
Merged

update expandable component #6920

merged 5 commits into from
Feb 20, 2025

Conversation

mirnawong1
Copy link
Contributor

@mirnawong1 mirnawong1 commented Feb 17, 2025

this pr updates the Expandable component to allow the contents within the expandable to be searchable. changes code from div to details to allow this and changes/updates css to ensure light and dark mode are supported

internal slack thread

note this isn't perfect as i can't seem to get it to work when searching via the search box, but it does appear as a result in algolia search. and then it does work and auto expand when you control/cmd f on the page

Screenshot 2025-02-17 at 11 06 07


🚀 Deployment available! Here are the direct links to the updated files:

Copy link

vercel bot commented Feb 17, 2025

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

Name Status Preview Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview Feb 20, 2025 2:56pm

@github-actions github-actions bot added content Improvements or additions to content size: medium This change will take up to a week to address Docs team Authored by the Docs team @dbt Labs labels Feb 17, 2025
Copy link
Contributor

@john-rock john-rock left a comment

Choose a reason for hiding this comment

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

Hey @mirnawong1 nice refactor here!

I just left one small request adjusting the CSS for the open/closed state on the chevron. Let me know if you have any questions with that.

Re: search box not working - I'm okay with this. Since it's using algolia we have much less control of how it functions when using that vs. in-browser search.

<div id={anchorId} className={`${styles.expandableContainer}`}>
<div className={styles.header} onClick={handleToggleClick}>
<span className={`${styles.toggle} ${isOn ? styles.toggleDown : styles.toggleRight}`}></span>
<details ref={detailsRef} id={anchorId} className={styles.expandableContainer} open={isOpen}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work setting the open attribute programmatically here.

Once small adjustment we need to make is adjusting the CSS for the chevron when ctrl + f searching.

You'll see in the screenshot even though the expandable is open, the chevron still is in the closed state.
About_the_dbt_Cloud_IDE___dbt_Developer_Hub

We should be able to clean this up by reading the open attribute within the CSS.

For example,
details[open] .toggle {transform: rotate(225deg);}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh great catch! thank you so much @john-rock ! ok updated it now and used ::before since the chevron arrow is rendered through a pseudo-element.

@@ -59,6 +59,10 @@
margin-right: 8px;
}

details[open] :local(.toggle)::before {
transform: rotate(225deg); /* this rotates the chevron down */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @john-rock , added this to fix the chevron detail. can you please re-review when you have a chance?

Copy link
Contributor

@john-rock john-rock left a comment

Choose a reason for hiding this comment

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

Awesome work @mirnawong1 lgtm!

@mirnawong1
Copy link
Contributor Author

awesome, thank yoU!

@mirnawong1 mirnawong1 merged commit 7ba93eb into current Feb 20, 2025
8 checks passed
@mirnawong1 mirnawong1 deleted the udpate-expandable branch February 20, 2025 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content 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.

2 participants