-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[Doc site]: Add tab switcher shortcode #4861
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
Conversation
Deploying with
|
Latest commit: |
39eed6f
|
Status: | ✅ Deploy successful! |
Preview URL: | https://8ac54c53.cloudflare-docs-7ou.pages.dev |
Branch Preview URL: | https://add-tab-switcher-shortcode-c.cloudflare-docs-7ou.pages.dev |
From a bit of testing, looks like only the final example ( |
Yea! Ignore this for now. It's a draft because I have to fix that bug. I have actually, but on a different branch. |
One question.. can't quite grok it just from looking at the code. Is the tab component generic enough to be used throughout the docs site? i.e., like for helping us group examples like this on this page into a two-tabbed |
Yes, it is! You will write the Shortcode just as you would an Aside |
@kodster28 you can test it now |
Co-authored-by: Gift Egwuenu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick bug I found. also, is there any sort of active tab CSS styling?
assets/events.ts
Outdated
const tabs = wrappers[i].querySelectorAll(".tab"); | ||
|
||
// Set the first tab in a group to display | ||
((tabs[0] as HTMLElement) || null).style.display = "block"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, now the browser wars. Let me look into how to fix that for safari. I tested on Mozilla and chrome. There is an active tab styling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codewithkristian I have put up some changes. Can you check if this behaviour presets?
…re/cloudflare-docs into add-tab-switcher-shortcode-comp
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assets/events.ts
Outdated
export function activeTab() { | ||
var header = document.getElementById("tab-active"); | ||
var tabs = header.getElementsByClassName("tab-label"); | ||
console.log(tabs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
assets/events.ts
Outdated
for (let i = 0; i < labels.length; i++) | ||
labels[i].addEventListener("click", $tab); | ||
} else { | ||
console.log({ wrappers, tabs, labels }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
…to add-tab-switcher-shortcode-comp
…to add-tab-switcher-shortcode-comp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out @Cherry 🙌🏾 |
#1/#3 - that's fine with me, disregard. For #2 if it's based on how we actually write the syntax that's great, I don't think we should add a hardcoded order. Can we fix the order here just so it merges in correctly? It's confusing as written right now. +1 from me once we land that ^ change |
Oh, I see what you mean! So I added the shortcode to the HTML form tutorial so that we see how it is displayed. After all the reviews, I will delete it from that tutorial because it's not needed there.
|
sounds good. can we remove it then and i'll +1 |
Some future feature requests (Not needed for MVP but worth noting):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out @Cherry 🙌🏾
Sorry for being overly picky, but now it's resulting in duplicate text for the tabs to a screen reader:
Co-authored-by: James Ross <[email protected]>
We have a follow-up ticket for 2. |
Since Workers introduced module syntax, we need a way to show the difference between service worker syntax and module syntax in our docs.
This PR, adds a shortcode that can be used within our current docs setup as we would an
Aside
for example.You can test it at https://add-tab-switcher-shortcode-c.cloudflare-docs-7ou.pages.dev/pages/tutorials/forms/
Todo: