Skip to content

Commit

Permalink
Update Compare.tsx (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshpaliyal authored Oct 18, 2024
1 parent 4c626c9 commit ca521f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ui/Compare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function Compare({
const [selectedAfterBenchmarks, setSelectedAfterBenchmarks] = useState<
Benchmark | undefined
>();
const [open, setOpen] = React.useState(false)

const metrics: string[] = useMemo(() => {
const metrics = new Set<string>();
Expand Down Expand Up @@ -90,7 +91,7 @@ export function Compare({

<div className="w-full flex flex-col">
{!!selectedMetric ? <h6>Metric</h6> : ""}
<Popover >
<Popover open={open} onOpenChange={setOpen} >
<PopoverTrigger asChild>
<Button variant="outline">
{selectedMetric ?? "Select Metric"}
Expand All @@ -107,7 +108,8 @@ export function Compare({
<CommandGroup>
{metrics?.map((metric) => {
return (
<CommandItem key={metric} value={metric} onSelect={(currentValue) => {setSelectedMetric(currentValue);}}>
<CommandItem key={metric} value={metric} onSelect={(currentValue) => {setSelectedMetric(currentValue);
setOpen(false);}}>
<Check
className={cn(
"mr-2 h-4 w-4",
Expand Down

0 comments on commit ca521f8

Please sign in to comment.