| 1 |
/** |
| 2 |
* BetterDocs Code Snippet Tab — Frontend Styles |
| 3 |
* |
| 4 |
* The Code Snippet Tab reuses the Code Snippet shell (wrapper / header / panels |
| 5 |
* / copy button / light+dark themes / line numbers) so every Code Snippet style |
| 6 |
* option applies here too. It swaps the language dropdown for a row of HTTP |
| 7 |
* status tabs. We import the Code Snippet frontend styles as the base, then add |
| 8 |
* only the tab-bar layer on top. |
| 9 |
*/ |
| 10 |
@import 'code-snippet'; |
| 11 |
|
| 12 |
.betterdocs-code-snippet-wrapper.betterdocs-code-snippet-tab { |
| 13 |
|
| 14 |
// Header reads as a tab strip: no vertical padding on the row, tabs align |
| 15 |
// to the header's bottom edge so the active underline meets the divider. |
| 16 |
.betterdocs-code-snippet-tab-header { |
| 17 |
align-items: stretch; |
| 18 |
} |
| 19 |
|
| 20 |
.betterdocs-file-preview-left { |
| 21 |
align-items: stretch; |
| 22 |
} |
| 23 |
|
| 24 |
// The status-tab bar. One button per response; the active one carries a |
| 25 |
// status-colored bottom border (tab underline). |
| 26 |
.betterdocs-code-snippet-tabs { |
| 27 |
display: flex; |
| 28 |
align-items: stretch; |
| 29 |
gap: 2px; |
| 30 |
flex-wrap: wrap; |
| 31 |
} |
| 32 |
|
| 33 |
.betterdocs-code-snippet-tab-item { |
| 34 |
display: inline-flex; |
| 35 |
align-items: center; |
| 36 |
gap: 6px; |
| 37 |
padding: 10px 12px; |
| 38 |
margin: 0; |
| 39 |
border: none; |
| 40 |
border-bottom: 2px solid transparent; |
| 41 |
border-radius: 0; |
| 42 |
background: transparent; |
| 43 |
color: inherit; |
| 44 |
font-family: inherit; |
| 45 |
font-size: 12px; |
| 46 |
font-weight: 600; |
| 47 |
line-height: 1.4; |
| 48 |
cursor: pointer; |
| 49 |
transition: color 0.15s ease, border-color 0.15s ease; |
| 50 |
|
| 51 |
// Box-shadow reset lives in code-snippet.scss (shared button reset). |
| 52 |
&:hover, |
| 53 |
&:focus, |
| 54 |
&:focus-visible, |
| 55 |
&:active { |
| 56 |
outline: none; |
| 57 |
} |
| 58 |
|
| 59 |
// Active tab underline — colored by status bucket. |
| 60 |
&.is-active { |
| 61 |
border-bottom-color: #8b949e; |
| 62 |
} |
| 63 |
&.is-active.betterdocs-api-response--2xx { border-bottom-color: #28ca42; } |
| 64 |
&.is-active.betterdocs-api-response--3xx { border-bottom-color: #ffbd2e; } |
| 65 |
&.is-active.betterdocs-api-response--4xx, |
| 66 |
&.is-active.betterdocs-api-response--5xx { border-bottom-color: #ff5f57; } |
| 67 |
} |
| 68 |
|
| 69 |
// Status color dot — mirrors the API-docs `--Nxx` scheme. |
| 70 |
.betterdocs-code-snippet-tab-dot { |
| 71 |
display: inline-block; |
| 72 |
width: 8px; |
| 73 |
height: 8px; |
| 74 |
border-radius: 50%; |
| 75 |
flex-shrink: 0; |
| 76 |
background: #8b949e; |
| 77 |
|
| 78 |
&.betterdocs-api-response--2xx { background: #28ca42; } |
| 79 |
&.betterdocs-api-response--3xx { background: #ffbd2e; } |
| 80 |
&.betterdocs-api-response--4xx, |
| 81 |
&.betterdocs-api-response--5xx { background: #ff5f57; } |
| 82 |
} |
| 83 |
|
| 84 |
.betterdocs-code-snippet-tab-label { |
| 85 |
white-space: nowrap; |
| 86 |
} |
| 87 |
|
| 88 |
// Light theme tab contrast. |
| 89 |
&.theme-light { |
| 90 |
.betterdocs-code-snippet-tab-item { |
| 91 |
color: #57606a; |
| 92 |
&:hover { color: #24292e; } |
| 93 |
&.is-active { color: #24292e; } |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
// Dark theme tab contrast. |
| 98 |
&.theme-dark { |
| 99 |
.betterdocs-code-snippet-tab-item { |
| 100 |
color: #8b949e; |
| 101 |
&:hover { color: #e6edf3; } |
| 102 |
&.is-active { color: #e6edf3; } |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
|