2017-10-12 00:01:37 +03:00
|
|
|
import * as React from 'react';
|
2024-06-06 17:03:18 +03:00
|
|
|
import { createRoot } from 'react-dom/client';
|
2021-06-09 14:57:36 +03:00
|
|
|
import type { RedocRawOptions } from '../../src/services/RedocNormalizedOptions';
|
2024-06-06 17:03:18 +03:00
|
|
|
import { RedocStandalone } from '../../src';
|
2017-10-12 00:01:37 +03:00
|
|
|
|
|
|
|
const big = window.location.search.indexOf('big') > -1;
|
2019-03-28 11:39:41 +03:00
|
|
|
const swagger = window.location.search.indexOf('swagger') > -1;
|
2017-10-12 00:01:37 +03:00
|
|
|
|
2019-03-28 11:39:41 +03:00
|
|
|
const userUrl = window.location.search.match(/url=(.*)$/);
|
|
|
|
|
|
|
|
const specUrl =
|
2024-04-02 18:16:44 +03:00
|
|
|
(userUrl && userUrl[1]) || (swagger ? 'museum.yaml' : big ? 'big-openapi.json' : 'museum.yaml');
|
2017-11-14 18:46:50 +03:00
|
|
|
|
2020-07-24 10:15:36 +03:00
|
|
|
const options: RedocRawOptions = { nativeScrollbars: false, maxDisplayedEnumValues: 3 };
|
2017-11-14 18:46:50 +03:00
|
|
|
|
2024-06-06 17:03:18 +03:00
|
|
|
const container = document.getElementById('example');
|
|
|
|
const root = createRoot(container!);
|
|
|
|
root.render(<RedocStandalone specUrl={specUrl} options={options} />);
|