diff --git a/assets/css/index.css b/assets/css/index.css index 28ae78149a..01872d7ae1 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -739,6 +739,58 @@ input[type="radio"] { appearance: none; } +/* Generic GitHub-style tabs */ +.generic-tabs { + @apply w-full mb-6; +} + +.generic-tabs .tab-nav { + @apply flex border-b border-redis-pen-300 bg-redis-neutral-200 rounded-t-md; +} + +.generic-tabs .tab-radio { + @apply sr-only; +} + +.generic-tabs .tab-label { + @apply px-4 py-3 cursor-pointer text-sm font-medium text-redis-pen-600 + bg-redis-neutral-200 border-r border-redis-pen-300 + hover:bg-white hover:text-redis-ink-900 + transition-colors duration-150 ease-in-out + focus:outline-none focus:ring-2 focus:ring-redis-red-500 focus:ring-inset + first:rounded-tl-md select-none; +} + +.generic-tabs .tab-label:last-child { + @apply border-r-0 rounded-tr-md; +} + +.generic-tabs .tab-radio:checked + .tab-label { + @apply bg-white text-redis-ink-900 border-b-2 border-b-redis-red-500 -mb-px relative z-10; +} + +.generic-tabs .tab-radio:focus + .tab-label { + @apply border-b-2 border-b-redis-red-500 -mb-px; +} + +.generic-tabs .tab-content { + @apply hidden px-6 pb-6 pt-3 bg-white border border-t-0 border-redis-pen-300 rounded-b-md shadow-sm; +} + +.generic-tabs .tab-content.active { + @apply block; +} + +/* Ensure proper stacking and borders */ +.generic-tabs .tab-content-container { + @apply relative -mt-px; +} + +/* Single content box styling (when no explicit tabs are provided) */ +.generic-tabs-single .tab-content-single { + @apply prose prose-lg max-w-none; +} + .stack-logo-inline { display: inline; max-height: 1em; diff --git a/layouts/partials/components/generic-tabs.html b/layouts/partials/components/generic-tabs.html new file mode 100644 index 0000000000..ae1dcd84a1 --- /dev/null +++ b/layouts/partials/components/generic-tabs.html @@ -0,0 +1,64 @@ +{{/* + Generic GitHub-style tabs component + + Usage: + {{ partial "components/generic-tabs.html" (dict "id" "my-tabs" "tabs" $tabs) }} + + Where $tabs is an array of dictionaries with "title" and "content" keys: + $tabs := slice + (dict "title" "Tab 1" "content" "Content for tab 1") + (dict "title" "Tab 2" "content" "Content for tab 2") +*/}} + +{{ $id := .id | default (printf "tabs-%s" (substr (.tabs | jsonify | md5) 0 8)) }} +{{ $tabs := .tabs | default (slice (dict "title" "Error" "content" "No tabs provided")) }} + +