Skip to content

Commit 139a805

Browse files
authored
Fix OpenAPI enum display (#3077)
1 parent da7b369 commit 139a805

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

.changeset/spotty-brooms-itch.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@gitbook/react-openapi': patch
3+
'gitbook': patch
4+
---
5+
6+
Fix OpenAPI enum display

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,11 @@
265265

266266
/* Schema Enum */
267267
.openapi-schema-enum {
268-
@apply flex flex-row text-sm leading-relaxed gap-2 flex-wrap text-tint;
269-
}
270-
271-
.openapi-schema-enum-list {
272-
@apply flex flex-row gap-1.5 items-center;
268+
@apply text-sm leading-relaxed max-w-full text-tint;
273269
}
274270

275271
.openapi-schema-enum-value {
276-
@apply text-sm;
272+
@apply text-sm mr-1.5;
277273
}
278274

279275
.openapi-schema-enum-value:first-child {

packages/react-openapi/src/OpenAPISchema.tsx

+14-16
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,20 @@ function OpenAPISchemaEnum(props: {
275275
}
276276

277277
return (
278-
<div className="openapi-schema-enum">
279-
<span>Available options:</span>
280-
<div className="openapi-schema-enum-list">
281-
{enumValues.map((item, index) => (
282-
<span key={index} className="openapi-schema-enum-value">
283-
<OpenAPICopyButton
284-
value={item.value}
285-
label={item.description}
286-
withTooltip={!!item.description}
287-
>
288-
<code>{`${item.value}`}</code>
289-
</OpenAPICopyButton>
290-
</span>
291-
))}
292-
</div>
293-
</div>
278+
<span className="openapi-schema-enum">
279+
Available options:{' '}
280+
{enumValues.map((item, index) => (
281+
<span key={index} className="openapi-schema-enum-value">
282+
<OpenAPICopyButton
283+
value={item.value}
284+
label={item.description}
285+
withTooltip={!!item.description}
286+
>
287+
<code>{`${item.value}`}</code>
288+
</OpenAPICopyButton>
289+
</span>
290+
))}
291+
</span>
294292
);
295293
}
296294

0 commit comments

Comments
 (0)