预览使用示例数据运行,不需要网络,也不需要渠道。
tsx
import { YuvaRoadmap } from "@/components/yuva-roadmap"
export function Roadmap() {
return (
<YuvaRoadmap
server={process.env.NEXT_PUBLIC_YUVA_SERVER}
channel={process.env.NEXT_PUBLIC_YUVA_CHANNEL}
/>
)
}安装
在 shadcn 项目中运行。文件会复制到你自己的代码里。
Shell
npx shadcn@latest add https://useyuva.com/r/yuva-roadmap.jsonShell
pnpm dlx shadcn@latest add https://useyuva.com/r/yuva-roadmap.jsonShell
yarn dlx shadcn@latest add https://useyuva.com/r/yuva-roadmap.jsonShell
bunx --bun shadcn@latest add https://useyuva.com/r/yuva-roadmap.json用法
tsx
import { YuvaRoadmap } from "@/components/yuva-roadmap"
<YuvaRoadmap server={server} channel={channel} />Props
YuvaRoadmapProps
| Prop | 类型 |
|---|---|
server? | string |
channel? | string |
identityToken? | IdentityTokenSource | null |
client? | YuvaClient |
defaultStage? | YuvaRoadmapStage |
labels? | Partial<YuvaRoadmapLabels> |
discussionLabels? | Partial<YuvaDiscussionsLabels> |
locale? | string |
className? | string |
YuvaRoadmapListProps
| Prop | 类型 |
|---|---|
stage? | YuvaRoadmapStage |
onStageChange? | (stage: YuvaRoadmapStage) => void |
onSelect | (idea: Discussion) => void |
onSuggest? | () => void |
labels? | Partial<YuvaRoadmapLabels> |
discussionLabels? | Partial<YuvaDiscussionsLabels> |
className? | string |
标签
每个标签都有英文默认值。传入部分 labels 对象即可修改或翻译。
| 标签 | 默认值 |
|---|---|
heading | "Roadmap" |
stageIdeas | "Ideas" |
stagePlanned | "Planned" |
stageInProgress | "In progress" |
stageShipped | "Shipped" |
stageClosed | "Closed" |
suggest | "Suggest an idea" |
suggestHeading | "Suggest an idea" |
suggestTitlePlaceholder | "Your idea in a few words" |
suggestBodyPlaceholder | "Describe it. What do you need, and why? Markdown works." |
sendIdea | "Send idea" |
similarIdeas | "Similar ideas" |
ideaSent | "Thanks! Your idea is on the board." |
ideaPending | "Thanks! The team will review your idea before it is shown." |
votingClosed | "Voting is closed for this idea." |
empty | "Nothing here yet." |
vote | (title) => `Vote for ${title}` |
removeVote | (title) => `Remove your vote for ${title}` |
votes | (count) => (count === 1 ? "1 vote" : `${count} votes`) |
back | "Roadmap" |
依赖
安装此项时还会添加以下内容。