Skip to content

Commit

Permalink
feat: tweak likes
Browse files Browse the repository at this point in the history
  • Loading branch information
seelengxd committed Sep 27, 2024
1 parent 91cf27c commit b56cde0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
4 changes: 1 addition & 3 deletions frontend/app/(authenticated)/events/[id]/event-analysis.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useState } from "react";
import { LucideThumbsDown, LucideThumbsUp, SparklesIcon } from "lucide-react";
import { SparklesIcon } from "lucide-react";

import {
EventDTO,
Expand All @@ -14,9 +14,7 @@ import {
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
import { Button } from "@/components/ui/button";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { cn } from "@/lib/utils";
import { useLikeEvent } from "@/queries/like";
import { useUserStore } from "@/store/user/user-store-provider";
import {
Expand Down
36 changes: 36 additions & 0 deletions frontend/components/likes/like-buttons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { LucideThumbsDown, LucideThumbsUp } from "lucide-react";

import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";

interface Props {
onLike: () => void;
onDislike: () => void;
userLikeValue: 0 | 1 | -1;
}

function LikeButtons({ onLike, onDislike, userLikeValue }: Props) {
return (
<div className="flex gap-6 items-center mt-4">
<p className="text-slate-600">Is this helpful?</p>
<div className="flex gap-1 items-center">
<Button onClick={onLike} size={"icon"} variant={"ghost"}>
<LucideThumbsUp
className={cn("stroke-slate-600", {
"fill-cyan-200": userLikeValue === 1,
})}
/>
</Button>
<Button onClick={onDislike} size={"icon"} variant={"ghost"}>
<LucideThumbsDown
className={cn("stroke-slate-600", {
"fill-cyan-200": userLikeValue === -1,
})}
/>
</Button>
</div>
</div>
);
}

export default LikeButtons;

0 comments on commit b56cde0

Please sign in to comment.