mirror of
https://gitea.com/gitea/docs.git
synced 2026-07-02 17:08:48 +00:00
Use custom api dropdown and fix compatibility for firefox (#39)
- Used custom api dropdown for changing label dynamically. Used method discussed in [this post](https://github.com/facebook/docusaurus/pull/7231). `ComponentTypes` is ejected safely.  - Fixed dropdowns missing on chrome docs page  - Fixed `:has` selector compatibility problem on firefox. After (Screenshots from firefox):     Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/39 Co-authored-by: HesterG <hestergong@gmail.com> Co-committed-by: HesterG <hestergong@gmail.com>
This commit is contained in:
@@ -13,13 +13,13 @@ function sortItemsByCategory(items) {
|
||||
return sortedItems;
|
||||
}
|
||||
|
||||
const includeAPI = process.env.INCLUDE_API !== 'false';
|
||||
const renderApiSSR = process.env.API_SSR !== 'false';
|
||||
|
||||
const apiConfig = [
|
||||
'redocusaurus',
|
||||
{
|
||||
// Plugin Options for loading OpenAPI files
|
||||
specs: includeAPI ? [
|
||||
specs: renderApiSSR ? [
|
||||
{
|
||||
spec: 'static/swagger-latest.json',
|
||||
route: '/api/next/',
|
||||
@@ -41,7 +41,7 @@ const apiConfig = [
|
||||
},
|
||||
]
|
||||
|
||||
const pageConfig = includeAPI ? {
|
||||
const pageConfig = renderApiSSR ? {
|
||||
exclude: [
|
||||
'api/**',
|
||||
],
|
||||
@@ -167,15 +167,14 @@ const config = {
|
||||
activeBaseRegex: 'api/(1.19|1.20|next)/',
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
type: 'custom-apiDropdown',
|
||||
label: 'API Version',
|
||||
position: 'right',
|
||||
items: [
|
||||
{to: '/api/next/', label: '1.21-dev' },
|
||||
{to: '/api/1.20/', label: '1.20.0-rc0' },
|
||||
{to: '/api/1.20/', label: '1.20.0-rc2' },
|
||||
{to: '/api/1.19/', label: '1.19.4' },
|
||||
],
|
||||
className: 'api-dropdown',
|
||||
},
|
||||
{
|
||||
href: 'https://github.com/go-gitea/gitea',
|
||||
|
||||
Reference in New Issue
Block a user