这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions docs/site/components/feedback-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export function FeedbackWidget() {
{ emoji: "😭", component: <FaceSad />, label: "Hate it" },
];

const handleSubmit = (e?: React.FormEvent<HTMLFormElement>): void => {
const handleSubmit = (
e?: React.FormEvent<HTMLFormElement> | React.MouseEvent<HTMLButtonElement>
): void => {
e?.preventDefault();

setLoading(true);
Expand Down Expand Up @@ -108,6 +110,19 @@ export function FeedbackWidget() {
/>
</div>

{!selectedEmoji && feedback ? (
<p
className="text-red-900 text-right mb-4 text-sm"
role="alert"
aria-live="assertive"
id="emoji-selection-error"
>
Please select an emoji.
</p>
) : (
<div className="h-9" />
)}

<div className="flex items-center justify-between text-black dark:text-gray-900">
<div className="flex space-x-4">
{emojis.map((item) => {
Expand All @@ -123,6 +138,11 @@ export function FeedbackWidget() {
: ""
)}
aria-label={item.label}
aria-describedby={
!selectedEmoji && feedback
? "emoji-selection-error"
: undefined
}
>
<span className="relative">{item.component}</span>
</button>
Expand All @@ -133,7 +153,9 @@ export function FeedbackWidget() {
<div className="flex items-center gap-2">
<Button
type="submit"
onClick={(e: any) => handleSubmit(e)}
onClick={(e: React.MouseEvent<HTMLButtonElement>) =>
handleSubmit(e)
}
disabled={loading || !feedback || !selectedEmoji}
>
Send
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-types/schemas/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,4 @@
"additionalProperties": false
}
}
}
}
2 changes: 1 addition & 1 deletion packages/turbo-types/schemas/schema.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,4 @@
"additionalProperties": false
}
}
}
}
2 changes: 1 addition & 1 deletion packages/turbo-types/schemas/schema.v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,4 @@
"additionalProperties": false
}
}
}
}
Loading