Skip to content

Commit 3b49ecc

Browse files
committed
Docs: add docs for feedback
1 parent 927ee8b commit 3b49ecc

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

apps/docs/components/rate.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { cva } from 'class-variance-authority';
1111
import { OpenPanel } from '@openpanel/web';
1212

1313
const rateButtonVariants = cva(
14-
'inline-flex items-center gap-2 px-3 py-2 rounded-full font-medium border bg-fd-secondary text-fd-secondary-foreground text-sm [&_svg]:size-4 disabled:cursor-not-allowed',
14+
'inline-flex items-center gap-2 px-3 py-2 rounded-full font-medium border text-sm [&_svg]:size-4 disabled:cursor-not-allowed',
1515
{
1616
variants: {
1717
active: {
@@ -142,12 +142,12 @@ export function Rate() {
142142
</button>
143143
</div>
144144
) : (
145-
<form className="flex flex-col gap-2" onSubmit={submit}>
145+
<form className="flex flex-col gap-3" onSubmit={submit}>
146146
<textarea
147147
autoFocus
148148
value={message}
149149
onChange={(e) => setMessage(e.target.value)}
150-
className="border rounded-xl bg-fd-secondary text-fd-secondary-foreground p-3 text-sm resize-none focus-visible:outline-none placeholder:text-fd-muted-foreground"
150+
className="border rounded-lg bg-fd-secondary text-fd-secondary-foreground p-3 text-sm resize-none focus-visible:outline-none placeholder:text-fd-muted-foreground"
151151
placeholder="Leave your feedback..."
152152
onKeyDown={(e) => {
153153
if (!e.shiftKey && e.key === 'Enter') {
@@ -157,7 +157,7 @@ export function Rate() {
157157
/>
158158
<button
159159
type="submit"
160-
className={cn(buttonVariants({ color: 'outline' }), 'w-fit px-4')}
160+
className={cn(buttonVariants({ color: 'outline' }), 'w-fit px-3')}
161161
>
162162
Submit
163163
</button>

apps/docs/content/docs/ui/feedback.mdx

+35-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Receive feedback from your users
77

88
Feedback is crucial for knowing what your reader thinks, and help you to further improve documentation content.
99

10-
### Setup
10+
### Installation
1111

1212
Copy the component.
1313

@@ -33,3 +33,37 @@ const feedback: Feedback = {
3333

3434
posthog.capture('on_rate_docs', feedback);
3535
```
36+
37+
### Add to Page
38+
39+
Now add the `<Rate />` component to your docs page:
40+
41+
```tsx
42+
import defaultMdxComponents from 'fumadocs-ui/mdx';
43+
import {
44+
DocsPage,
45+
DocsTitle,
46+
DocsDescription,
47+
DocsBody,
48+
} from 'fumadocs-ui/page';
49+
import { Rate } from '@/components/rate';
50+
51+
export default async function Page() {
52+
// other logic
53+
54+
return (
55+
<DocsPage toc={toc} full={page.data.full}>
56+
<DocsTitle>{page.data.title}</DocsTitle>
57+
<DocsDescription>{page.data.description}</DocsDescription>
58+
<DocsBody>
59+
<Mdx
60+
components={{
61+
...defaultMdxComponents,
62+
}}
63+
/>
64+
</DocsBody>
65+
<Rate />
66+
</DocsPage>
67+
);
68+
}
69+
```

0 commit comments

Comments
 (0)