Bản xem trước chạy trên dữ liệu mẫu. Không cần mạng hay kênh.
tsx
import { YuvaDiscussionComposer } from "@/components/yuva-discussion-composer"
import { YuvaDiscussionsProvider } from "@/hooks/use-yuva-discussions"
export function Docs({ children }: { children: React.ReactNode }) {
return (
<YuvaDiscussionsProvider
server={process.env.NEXT_PUBLIC_YUVA_SERVER}
channel={process.env.NEXT_PUBLIC_YUVA_CHANNEL}
>
<YuvaDiscussionComposer withTitle onSubmit={async ({ title, body }) => save(title, body)} />
</YuvaDiscussionsProvider>
)
}Cài đặt
Chạy lệnh này trong một dự án shadcn. Các tệp được sao chép vào mã của bạn.
Shell
npx shadcn@latest add https://useyuva.com/r/yuva-discussion-composer.jsonShell
pnpm dlx shadcn@latest add https://useyuva.com/r/yuva-discussion-composer.jsonShell
yarn dlx shadcn@latest add https://useyuva.com/r/yuva-discussion-composer.jsonShell
bunx --bun shadcn@latest add https://useyuva.com/r/yuva-discussion-composer.jsonCách dùng
tsx
import { YuvaDiscussionComposer } from "@/components/yuva-discussion-composer"
<YuvaDiscussionComposer withTitle onSubmit={async ({ title, body }) => {}} />Props
YuvaDiscussionComposerProps
| Prop | Kiểu |
|---|---|
withTitle? | boolean |
initialTitle? | string |
initialBody? | string |
submitLabel? | string |
placeholder? | string |
autoFocus? | boolean |
labels? | Partial<YuvaDiscussionsLabels> |
className? | string |
onTitleChange? | (title: string) => void |
onSubmit | (input: { title: string; body: string }) => Promise<unknown> |
onCancel? | () => void |
YuvaSignInProps
| Prop | Kiểu |
|---|---|
labels? | Partial<YuvaDiscussionsLabels> |
className? | string |
Nhãn
Các nhãn được liệt kê ở Yuva discussions.
Phụ thuộc
Cài mục này cũng sẽ thêm các mục sau.