Skip to content

Commit 7a504b7

Browse files
authored
Fix OpenAPI response dropdown & vertical overflow (#3678)
1 parent 8ec5fd0 commit 7a504b7

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

.changeset/twelve-bears-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": patch
3+
---
4+
5+
Fix OpenAPI response dropdown & vertical overflow

packages/gitbook/src/components/DocumentView/CodeBlock/CodeBlockRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const CodeBlockRenderer = forwardRef(function CodeBlockRenderer(
3232
<div
3333
ref={ref}
3434
aria-busy={ariaBusy}
35-
className={tcls('group/codeblock grid grid-flow-col', style)}
35+
className={tcls('group/codeblock grid shrink grid-flow-col overflow-hidden', style)}
3636
>
3737
<div className="flex items-center justify-start gap-2 text-sm [grid-area:1/1]">
3838
{title ? (

packages/gitbook/src/components/DocumentView/OpenAPI/style.css

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@
143143
}
144144

145145
.openapi-column-preview {
146-
@apply flex flex-col flex-1;
146+
@apply flex flex-col flex-1 xl:max-2xl:pt-20 lg:py-6 sticky max-h-[calc(100vh-var(--toc-top-offset))] top-(--toc-top-offset);
147147
}
148148

149149
.openapi-column-preview-body {
150-
@apply flex flex-col gap-4 sticky top-[calc(var(--toc-top-offset)+5rem)] print-mode:static;
150+
@apply flex flex-col shrink overflow-hidden gap-4 print-mode:static;
151151
}
152152

153153
.openapi-column-preview pre {
@@ -510,13 +510,21 @@
510510
.openapi-panel,
511511
.openapi-codesample,
512512
.openapi-response-examples {
513-
@apply border rounded-md straight-corners:rounded-none circular-corners:rounded-xl bg-tint-subtle border-tint-subtle shadow-sm;
513+
@apply border shrink min-h-40 overflow-hidden rounded-md straight-corners:rounded-none circular-corners:rounded-xl bg-tint-subtle border-tint-subtle shadow-sm;
514+
}
515+
516+
.openapi-response-examples-panel {
517+
@apply flex flex-col shrink overflow-hidden;
518+
}
519+
520+
.openapi-codesample-panel {
521+
@apply flex flex-col shrink overflow-hidden;
514522
}
515523

516524
.openapi-panel pre,
517525
.openapi-codesample pre,
518526
.openapi-response-examples pre {
519-
@apply bg-transparent border-none rounded-none shadow-none;
527+
@apply bg-transparent border-none rounded-none shrink shadow-none;
520528
}
521529

522530
.openapi-panel-heading {
@@ -579,7 +587,7 @@ body:has(.openapi-select-popover) {
579587
}
580588

581589
.openapi-select > button {
582-
@apply flex items-center font-normal cursor-pointer *:truncate gap-1.5 text-tint-strong max-w-32 rounded text-xs p-1.5 leading-none border border-tint-subtle bg-tint;
590+
@apply flex items-center font-normal cursor-pointer *:truncate gap-1.5 text-tint-strong rounded text-xs p-1.5 leading-none border border-tint-subtle bg-tint;
583591
@apply hover:bg-tint-hover transition-all;
584592
}
585593

@@ -613,7 +621,7 @@ body:has(.openapi-select-popover) {
613621
}
614622

615623
.openapi-select-item {
616-
@apply text-sm flex items-center cursor-pointer px-1.5 overflow-hidden py-1 *:truncate text-tint ring-0 border-none rounded !outline-none;
624+
@apply text-sm flex items-center cursor-pointer px-1.5 overflow-hidden py-1 text-tint ring-0 border-none rounded !outline-none;
617625
@apply hover:bg-tint-hover hover:theme-gradient:bg-tint-12/1 hover:text-tint-strong contrast-more:hover:ring-1 contrast-more:hover:ring-inset contrast-more:hover:ring-current;
618626
}
619627

@@ -638,6 +646,14 @@ body:has(.openapi-select-popover) {
638646
}
639647

640648
/* Section Components */
649+
.openapi-section {
650+
@apply flex flex-col overflow-hidden;
651+
}
652+
653+
.openapi-section-body {
654+
@apply flex flex-col shrink overflow-hidden;
655+
}
656+
641657
.openapi-section-header {
642658
@apply flex flex-row items-center;
643659
}

0 commit comments

Comments
 (0)