mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-16 02:50:48 +00:00
📝 Docs: 插件发布表单描述优化 (#3520)
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import React from "react";
|
||||
|
||||
import Link from "@docusaurus/Link";
|
||||
|
||||
import { Form } from ".";
|
||||
|
||||
export default function PluginForm(): React.ReactNode {
|
||||
@ -8,7 +10,7 @@ export default function PluginForm(): React.ReactNode {
|
||||
name: "包信息",
|
||||
items: [
|
||||
{ type: "text", name: "pypi", labelText: "PyPI 项目名" },
|
||||
{ type: "text", name: "module", labelText: "插件 import 包名" },
|
||||
{ type: "text", name: "module", labelText: "插件模块名" },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -29,7 +31,25 @@ export default function PluginForm(): React.ReactNode {
|
||||
);
|
||||
};
|
||||
|
||||
const description = (
|
||||
<p>
|
||||
请在发布前阅读{" "}
|
||||
<Link
|
||||
className="text-primary"
|
||||
href="https://nonebot.dev/docs/developer/plugin-publishing"
|
||||
>
|
||||
NoneBot 插件发布流程指导
|
||||
</Link>
|
||||
,并确保满足其中所述条件。
|
||||
</p>
|
||||
);
|
||||
|
||||
return (
|
||||
<Form type="plugin" formItems={formItems} handleSubmit={handleSubmit} />
|
||||
<Form
|
||||
type="plugin"
|
||||
formItems={formItems}
|
||||
handleSubmit={handleSubmit}
|
||||
description={description}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ export type FormItemGroup = {
|
||||
|
||||
export type Props = {
|
||||
children?: React.ReactNode;
|
||||
description?: React.ReactNode;
|
||||
type: Resource["resourceType"];
|
||||
formItems: FormItemGroup[];
|
||||
handleSubmit: (result: Record<string, string>) => void;
|
||||
@ -32,6 +33,7 @@ export type Props = {
|
||||
export function Form({
|
||||
type,
|
||||
children,
|
||||
description,
|
||||
formItems,
|
||||
handleSubmit,
|
||||
}: Props): React.ReactNode {
|
||||
@ -65,7 +67,6 @@ export function Form({
|
||||
);
|
||||
if (currentStepNames.every((name) => result[name])) {
|
||||
setCurrentStep(currentStep + 1);
|
||||
} else {
|
||||
}
|
||||
};
|
||||
const onPrev = () => currentStep > 0 && setCurrentStep(currentStep - 1);
|
||||
@ -86,6 +87,9 @@ export function Form({
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{description && currentStep === 0 && (
|
||||
<div className="form-description">{description}</div>
|
||||
)}
|
||||
<div className="form-control w-full min-h-[300px]">
|
||||
{children ||
|
||||
formItems[currentStep].items.map((item) => (
|
||||
|
Reference in New Issue
Block a user