The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | --- |
| 2 | import { TAB_ICONS } from "../../docs-icons"; |
| 3 | import { DOCS_TABS, DOCS_TAB_GROUPS, activeTab, groupTabs } from "../../docs-tabs"; |
| 4 | |
| 5 | const start = DOCS_TABS.filter((tab) => tab.slot === "start"); |
| 6 | const current = activeTab(Astro.url.pathname); |
| 7 | --- |
| 8 | |
| 9 | <nav class="alc-tabs" aria-label="Documentation sections"> |
| 10 | <div class="alc-tabs__group"> |
| 11 | { |
| 12 | start.map((tab) => ( |
| 13 | <a |
| 14 | href={tab.href} |
| 15 | class:list={["alc-tabs__tab", { "alc-tabs__tab--active": tab.label === current.label }]} |
| 16 | aria-current={tab.label === current.label ? "true" : undefined} |
| 17 | > |
| 18 | {TAB_ICONS[tab.label] && ( |
| 19 | <svg |
| 20 | class="alc-tabs__icon" |
| 21 | aria-hidden="true" |
| 22 | width="14" |
| 23 | height="14" |
| 24 | viewBox="0 0 24 24" |
| 25 | set:html={TAB_ICONS[tab.label]} |
| 26 | /> |
| 27 | )} |
| 28 | {tab.label} |
| 29 | </a> |
| 30 | )) |
| 31 | } |
| 32 | |
| 33 | {/* One hover dropdown per hub category (single-hub categories |
| 34 | share "More"); the group you're in is underlined and names the |
| 35 | current hub ("Clouds · AWS"). */} |
| 36 | { |
| 37 | DOCS_TAB_GROUPS.map((group) => { |
| 38 | const activeHere = groupTabs(group).some((tab) => tab.label === current.label); |
| 39 | return ( |
| 40 | <div class="alc-tabs__menu-root"> |
| 41 | <button |
| 42 | type="button" |
| 43 | class:list={["alc-tabs__tab", "alc-tabs__trigger", { "alc-tabs__tab--active": activeHere }]} |
| 44 | aria-haspopup="true" |
| 45 | > |
| 46 | {group.label} |
| 47 | {activeHere && <span class="alc-tabs__trigger-current">{current.label}</span>} |
| 48 | <svg |
| 49 | class="alc-tabs__chevron" |
| 50 | aria-hidden="true" |
| 51 | width="12" |
| 52 | height="12" |
| 53 | viewBox="0 0 24 24" |
| 54 | fill="none" |
| 55 | stroke="currentColor" |
| 56 | stroke-width="2" |
| 57 | stroke-linecap="round" |
| 58 | stroke-linejoin="round" |
| 59 | > |
| 60 | <path d="m6 9 6 6 6-6" /> |
| 61 | </svg> |
| 62 | </button> |
| 63 | <div class="alc-tabs__menu"> |
| 64 | {group.sections.map((section) => ( |
| 65 | <div class="alc-tabs__menu-section"> |
| 66 | {section.heading && <div class="alc-tabs__menu-heading">{section.heading}</div>} |
| 67 | {section.tabs.map((tab) => ( |
| 68 | <a |
| 69 | href={tab.href} |
| 70 | class:list={["alc-tabs__menu-item", { "alc-tabs__menu-item--active": tab.label === current.label }]} |
| 71 | aria-current={tab.label === current.label ? "true" : undefined} |
| 72 | > |
| 73 | {TAB_ICONS[tab.label] && ( |
| 74 | <svg |
| 75 | class="alc-tabs__icon" |
| 76 | aria-hidden="true" |
| 77 | width="16" |
| 78 | height="16" |
| 79 | viewBox="0 0 24 24" |
| 80 | set:html={TAB_ICONS[tab.label]} |
| 81 | /> |
| 82 | )} |
| 83 | <span class="alc-tabs__menu-text"> |
| 84 | <span>{tab.label}</span> |
| 85 | {tab.hint && <span class="alc-tabs__menu-hint">{tab.hint}</span>} |
| 86 | </span> |
| 87 | </a> |
| 88 | ))} |
| 89 | </div> |
| 90 | ))} |
| 91 | </div> |
| 92 | </div> |
| 93 | ); |
| 94 | }) |
| 95 | } |
| 96 | </div> |
| 97 | |
| 98 | </nav> |
| 99 | |
| 100 | <style> |
| 101 | .alc-tabs { |
| 102 | display: flex; |
| 103 | align-items: stretch; |
| 104 | gap: 16px; |
| 105 | height: var(--alc-tabs-height, 2.5rem); |
| 106 | margin: 0 calc(-1 * var(--sl-nav-pad-x)); |
| 107 | padding: 0 calc(var(--sl-nav-pad-x) - 12px); |
| 108 | } |
| 109 | .alc-tabs__group { |
| 110 | display: flex; |
| 111 | align-items: stretch; |
| 112 | gap: 2px; |
| 113 | } |
| 114 | .alc-tabs__tab { |
| 115 | display: inline-flex; |
| 116 | align-items: center; |
| 117 | gap: 7px; |
| 118 | padding: 0 12px; |
| 119 | font-size: 13.5px; |
| 120 | color: var(--alc-fg-2); |
| 121 | text-decoration: none; |
| 122 | border: 0; |
| 123 | border-bottom: 2px solid transparent; |
| 124 | background: transparent; |
| 125 | font-family: inherit; |
| 126 | cursor: pointer; |
| 127 | white-space: nowrap; |
| 128 | transition: color var(--alc-dur) var(--alc-ease); |
| 129 | } |
| 130 | .alc-tabs__tab:hover { |
| 131 | color: var(--alc-accent-deep); |
| 132 | } |
| 133 | .alc-tabs__tab--active { |
| 134 | color: var(--alc-accent-deep); |
| 135 | font-weight: 500; |
| 136 | border-bottom-color: var(--alc-accent-deep); |
| 137 | } |
| 138 | .alc-tabs__icon { |
| 139 | flex-shrink: 0; |
| 140 | opacity: 0.85; |
| 141 | } |
| 142 | .alc-tabs__chevron { |
| 143 | margin-inline-start: -2px; |
| 144 | opacity: 0.7; |
| 145 | transition: transform var(--alc-dur) var(--alc-ease); |
| 146 | } |
| 147 | .alc-tabs__menu-root { |
| 148 | position: relative; |
| 149 | display: flex; |
| 150 | align-items: stretch; |
| 151 | } |
| 152 | .alc-tabs__trigger { |
| 153 | user-select: none; |
| 154 | } |
| 155 | /* "Clouds · AWS" — names the hub you're in without a tab per hub. */ |
| 156 | .alc-tabs__trigger-current::before { |
| 157 | content: "·"; |
| 158 | margin-inline-end: 7px; |
| 159 | color: var(--alc-fg-4); |
| 160 | font-weight: 400; |
| 161 | } |
| 162 | /* Menus open on hover and collapse as soon as the pointer leaves the |
| 163 | trigger + menu. Keyboard users open them by tabbing in (:focus-visible |
| 164 | only, so a mouse click doesn't pin a menu open after moving off). */ |
| 165 | .alc-tabs__menu-root:hover > .alc-tabs__trigger, |
| 166 | .alc-tabs__menu-root:has(:focus-visible) > .alc-tabs__trigger { |
| 167 | color: var(--alc-accent-deep); |
| 168 | } |
| 169 | .alc-tabs__menu-root:hover .alc-tabs__chevron, |
| 170 | .alc-tabs__menu-root:has(:focus-visible) .alc-tabs__chevron { |
| 171 | transform: rotateZ(180deg); |
| 172 | } |
| 173 | .alc-tabs__menu-root:hover > .alc-tabs__menu, |
| 174 | .alc-tabs__menu-root:has(:focus-visible) > .alc-tabs__menu { |
| 175 | display: block; |
| 176 | } |
| 177 | .alc-tabs__menu { |
| 178 | display: none; |
| 179 | position: absolute; |
| 180 | top: 100%; |
| 181 | inset-inline-start: 0; |
| 182 | min-width: 300px; |
| 183 | /* The menu opens directly below the fixed header; cap it to the |
| 184 | remaining viewport and scroll so short windows don't clip items. */ |
| 185 | max-height: calc(100dvh - var(--sl-nav-height) - 1rem); |
| 186 | overflow-y: auto; |
| 187 | overscroll-behavior: contain; |
| 188 | z-index: 30; |
| 189 | background: var(--alc-bg); |
| 190 | border: 1px solid var(--alc-hairline-2); |
| 191 | border-radius: 10px; |
| 192 | padding: 6px; |
| 193 | box-shadow: var(--alc-shadow-md, 0 8px 24px rgb(0 0 0 / 0.12)); |
| 194 | } |
| 195 | .alc-tabs__menu-section + .alc-tabs__menu-section { |
| 196 | border-top: 1px solid var(--alc-hairline); |
| 197 | margin-top: 6px; |
| 198 | padding-top: 6px; |
| 199 | } |
| 200 | .alc-tabs__menu-heading { |
| 201 | padding: 4px 10px; |
| 202 | font-size: 10.5px; |
| 203 | font-weight: 600; |
| 204 | letter-spacing: 0.07em; |
| 205 | text-transform: uppercase; |
| 206 | color: var(--alc-fg-4); |
| 207 | } |
| 208 | .alc-tabs__menu-item { |
| 209 | display: flex; |
| 210 | align-items: flex-start; |
| 211 | gap: 11px; |
| 212 | padding: 7px 10px; |
| 213 | border-radius: 7px; |
| 214 | font-size: 13px; |
| 215 | color: var(--alc-fg-2); |
| 216 | text-decoration: none; |
| 217 | } |
| 218 | .alc-tabs__menu-item > .alc-tabs__icon { |
| 219 | margin-block-start: calc((1lh - 16px) / 2); |
| 220 | } |
| 221 | .alc-tabs__menu-item:hover { |
| 222 | color: var(--alc-accent-deep); |
| 223 | background: var(--alc-bg-elev-1); |
| 224 | } |
| 225 | .alc-tabs__menu-item--active { |
| 226 | color: var(--alc-accent-deep); |
| 227 | font-weight: 500; |
| 228 | background: color-mix(in srgb, var(--alc-accent-deep) 10%, transparent); |
| 229 | } |
| 230 | /* Stacked label + hint: every row renders the same height regardless |
| 231 | of hint length; a too-long hint ellipsizes instead of wrapping. */ |
| 232 | .alc-tabs__menu-text { |
| 233 | display: flex; |
| 234 | flex-direction: column; |
| 235 | gap: 1px; |
| 236 | min-width: 0; |
| 237 | } |
| 238 | .alc-tabs__menu-hint { |
| 239 | font-size: 11px; |
| 240 | color: var(--alc-fg-4); |
| 241 | white-space: nowrap; |
| 242 | overflow: hidden; |
| 243 | text-overflow: ellipsis; |
| 244 | } |
| 245 | /* Below 72rem the category row no longer fits: product navigation moves |
| 246 | to the MobileTabSwitcher at the top of the sidebar / hamburger drawer |
| 247 | instead of a horizontally scrollable strip nothing signals you can |
| 248 | scroll. Keep in sync with MobileTabSwitcher.astro and custom.css. */ |
| 249 | @media (max-width: 72rem) { |
| 250 | .alc-tabs { |
| 251 | display: none; |
| 252 | } |
| 253 | } |
| 254 | </style> |