Introduce runner documentations (#133)

This PR introduces documentation for Runner.

<img width="959" alt="图片.png" src="attachments/5ad6a8af-d799-4718-9d33-56bf91a8852e">

Co-authored-by: kerwin612 <kerwin612@qq.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/133
Reviewed-by: Bo-Yi Wu (吳柏毅) <appleboy.tw@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Lunny Xiao
2024-12-26 23:44:25 +00:00
committed by Lunny Xiao
parent 8f872a636d
commit 433c930127
8 changed files with 312 additions and 48 deletions

View File

@@ -1,23 +0,0 @@
import React from 'react';
import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
import {useLocation} from '@docusaurus/router';
export default function APIDropDown(props) {
const {pathname} = useLocation();
let newLabel = props.label;
// isAPI indicates if the current page is a api page
let isAPI = false;
for (const item of props.items) {
// paths like /zh-cn/api/{version}/ are also api pages
if (pathname === item.to || pathname === `/zh-cn${item.to}`) {
if (!props.mobile) newLabel = item.label;
isAPI = true;
break;
}
}
const newProps = {...props, label: newLabel};
// Hide api dropdown on non api pages
return (
<DropdownNavbarItem {...newProps} className={`api-dropdown${isAPI? '': ' gt-hidden'}`}></DropdownNavbarItem>
);
}

View File

@@ -0,0 +1,18 @@
import React from 'react';
import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
import {useLocation} from '@docusaurus/router';
export default function DropDown(props) {
const {pathname} = useLocation();
const {routerRgx, classNames} = props;
const r = new RegExp(routerRgx);
let isMatched = r.test(pathname);
let newLabel = props.label;
if (isMatched) {
newLabel = props.items.filter(item => item.to === pathname)[0]?.label ?? newLabel;
}
const newProps = {...props, label: newLabel};
return (
<DropdownNavbarItem {...newProps} className={`custom-dropdown ${classNames}${isMatched ? ' gt-visible': ' gt-hidden'}`}></DropdownNavbarItem>
);
}