Podgląd działa na danych przykładowych. Nie potrzebuje sieci ani kanału.
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>
)
}Instalacja
Uruchom to w projekcie shadcn. Pliki zostaną skopiowane do twojego kodu.
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.jsonUżycie
tsx
import { YuvaDiscussionComposer } from "@/components/yuva-discussion-composer"
<YuvaDiscussionComposer withTitle onSubmit={async ({ title, body }) => {}} />Props
YuvaDiscussionComposerProps
| Prop | Typ |
|---|---|
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 | Typ |
|---|---|
labels? | Partial<YuvaDiscussionsLabels> |
className? | string |
Etykiety
Etykiety są wymienione na stronie Yuva discussions.
Zależności
Instalacja tego elementu dodaje też poniższe.