mirror of
https://gitea.com/gitea/docs.git
synced 2026-09-18 03:58:52 +00:00
This PR introduces documentation for Runner. <img width="959" alt="图片.png" src="attachments/5ad6a8af-d799-4718-9d33-56bf91a8852e"> Co-authored-by: kerwin612 <[email protected]> Reviewed-on: https://gitea.com/gitea/docs/pulls/133 Reviewed-by: Bo-Yi Wu (吳柏毅) <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-committed-by: Lunny Xiao <[email protected]>
19 lines
689 B
JavaScript
19 lines
689 B
JavaScript
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>
|
|
);
|
|
}
|