Skip to content

Commit

Permalink
Add tooltips to feedback thumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
albandum committed Nov 26, 2024
1 parent ca607bf commit 3cea924
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions sparkle/src/components/ConversationMessageFeedbackSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "@sparkle/components/Popover";
import { TextArea } from "@sparkle/components/TextArea";
import { HandThumbDownIcon, HandThumbUpIcon } from "@sparkle/icons/solid";
import { Tooltip } from "@sparkle/index_with_tw_base";

Check failure on line 12 in sparkle/src/components/ConversationMessageFeedbackSelector.tsx

View workflow job for this annotation

GitHub Actions / check-eslint

'@sparkle/index_with_tw_base' import is restricted from being used by a pattern

export type ThumbReaction = "up" | "down";
export type ConversationMessageFeedbackType = {
Expand Down Expand Up @@ -58,21 +59,31 @@ export function FeedbackSelector(
<PopoverRoot open={isPopoverOpen}>
<PopoverTrigger asChild>
<div className="s-flex s-items-center">
<Button
variant={feedback?.thumb === "up" ? "highlight" : "outline"}
size="xs"
disabled={isSubmittingThumb}
onClick={() => selectThumb("up")}
className={"s-rounded-r-none s-border-r-0"}
icon={HandThumbUpIcon}
<Tooltip
label="I love this answer!"
trigger={
<Button
variant={feedback?.thumb === "up" ? "highlight" : "outline"}
size="xs"
disabled={isSubmittingThumb}
onClick={() => selectThumb("up")}
className={"s-rounded-r-none s-border-r-0"}
icon={HandThumbUpIcon}
/>
}
/>
<Button
variant={feedback?.thumb === "down" ? "highlight" : "outline"}
size="xs"
disabled={isSubmittingThumb}
onClick={() => selectThumb("down")}
className={"s-rounded-l-none s-border-l-0"}
icon={HandThumbDownIcon}
<Tooltip
label="This answer is not good enough."
trigger={
<Button
variant={feedback?.thumb === "down" ? "highlight" : "outline"}
size="xs"
disabled={isSubmittingThumb}
onClick={() => selectThumb("down")}
className={"s-rounded-l-none s-border-l-0"}
icon={HandThumbDownIcon}
/>
}
/>
</div>
</PopoverTrigger>
Expand Down

0 comments on commit 3cea924

Please sign in to comment.