mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 07:35:16 +00:00
Select variables in server url
This commit is contained in:
@@ -12,5 +12,25 @@ export function OpenAPIServerURLVariable(props: {
|
||||
variable: OpenAPIV3.ServerVariableObject;
|
||||
}) {
|
||||
const { variable } = props;
|
||||
|
||||
if (variable.enum && variable.enum.length > 0) {
|
||||
return (<select
|
||||
className={classNames(
|
||||
'openapi-section-select',
|
||||
'openapi-select',
|
||||
)}
|
||||
value={variable.default}
|
||||
>
|
||||
{
|
||||
variable.enum?.map((value: string) => {
|
||||
return (
|
||||
<option key={value} value={value}>
|
||||
{value}
|
||||
</option>
|
||||
);
|
||||
}) ?? null}
|
||||
</select>);
|
||||
|
||||
}
|
||||
return <span className={classNames('openapi-url-var')}>{variable.default}</span>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user