[Doc site]: Add tab switcher shortcode#4861
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 <laurandidi21@gmail.com>
kristianfreeman
left a comment
There was a problem hiding this comment.
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.
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.
@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. |
assets/events.ts
Outdated
| export function activeTab() { | ||
| var header = document.getElementById("tab-active"); | ||
| var tabs = header.getElementsByClassName("tab-label"); | ||
| console.log(tabs) |
assets/events.ts
Outdated
| for (let i = 0; i < labels.length; i++) | ||
| labels[i].addEventListener("click", $tab); | ||
| } else { | ||
| console.log({ wrappers, tabs, labels }); |
…to add-tab-switcher-shortcode-comp
…to add-tab-switcher-shortcode-comp
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):
|
Co-authored-by: James Ross <james@jross.me>
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
Asidefor example.You can test it at https://add-tab-switcher-shortcode-c.cloudflare-docs-7ou.pages.dev/pages/tutorials/forms/
Todo: