Skip to content

Commit bea74ff

Browse files
committed
feat: use popover component instead of tooltip for info buttons on create collection form
1 parent 62552a6 commit bea74ff

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

components/collections/collection-form.tsx

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,14 @@ import request from "graphql-request";
2525
import { isValidHypercertId } from "@/lib/utils";
2626
import { useQuery } from "@tanstack/react-query";
2727
import { parseClaimOrFractionId } from "@hypercerts-org/sdk";
28-
import {
29-
Tooltip,
30-
TooltipContent,
31-
TooltipProvider,
32-
TooltipTrigger,
33-
} from "@/components/ui/tooltip";
3428
import React, { ReactNode } from "react";
3529
import { ExternalLink, InfoIcon, LoaderCircle } from "lucide-react";
3630
import Link from "next/link";
3731
import { useCreateHyperboard, useUpdateHyperboard } from "@/collections/hooks";
3832
import { useBlueprintsByIds } from "@/blueprints/hooks/useBlueprintsByIds";
3933
import { BlueprintFragment } from "@/blueprints/blueprint.fragment";
4034
import { isParseableNumber } from "@/lib/isParseableInteger";
35+
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
4136

4237
const idSchema = z
4338
.string()
@@ -338,10 +333,10 @@ export const CollectionForm = ({
338333
{index === 0 && (
339334
<FormLabel>
340335
Hypercert ID{" "}
341-
<InfoTooltip>
336+
<InfoPopover>
342337
You can find the Hypercert ID on the view
343338
page of the hypercert.
344-
</InfoTooltip>
339+
</InfoPopover>
345340
</FormLabel>
346341
)}
347342
<FormControl>
@@ -363,12 +358,12 @@ export const CollectionForm = ({
363358
{index === 0 && (
364359
<FormLabel>
365360
Factor{" "}
366-
<InfoTooltip>
361+
<InfoPopover>
367362
You can adjust the relative importance of a
368363
hypercert within this collection, which will
369364
be visually represented on the hyperboard.
370365
The default is 1 for each hypercert.
371-
</InfoTooltip>
366+
</InfoPopover>
372367
</FormLabel>
373368
)}
374369
<FormControl>
@@ -426,11 +421,11 @@ export const CollectionForm = ({
426421
{!fields.length && (
427422
<FormLabel>
428423
Hypercert or blueprint ID*{" "}
429-
<InfoTooltip>
424+
<InfoPopover>
430425
You can find the Hypercert or blueprint ID on the
431426
view page of the hypercert or in the profile
432427
blueprints overview.
433-
</InfoTooltip>
428+
</InfoPopover>
434429
</FormLabel>
435430
)}
436431
<FormControl>
@@ -448,12 +443,12 @@ export const CollectionForm = ({
448443
{!fields.length && (
449444
<FormLabel>
450445
Factor*{" "}
451-
<InfoTooltip>
446+
<InfoPopover>
452447
You can adjust the relative importance of a
453448
hypercert within this collection, which will be
454449
visually represented on the hyperboard. The
455450
default is 1 for each hypercert.
456-
</InfoTooltip>
451+
</InfoPopover>
457452
</FormLabel>
458453
)}
459454
<FormControl>
@@ -506,11 +501,11 @@ export const CollectionForm = ({
506501
<FormItem>
507502
<FormLabel>
508503
Background image URL{" "}
509-
<InfoTooltip>
504+
<InfoPopover>
510505
For best results use an aspect ratio of 16:9. The best
511506
resolution depends on where it will be shown; we
512507
recommend at least 1600x900 px.
513-
</InfoTooltip>
508+
</InfoPopover>
514509
</FormLabel>
515510
<FormControl>
516511
<Input {...field} />
@@ -520,6 +515,7 @@ export const CollectionForm = ({
520515
)}
521516
/>
522517
{backgroundImg && (
518+
// eslint-disable-next-line @next/next/no-img-element
523519
<img
524520
src={backgroundImg}
525521
className="max-h-80"
@@ -618,18 +614,16 @@ const HypercertErrorMessages = ({
618614
);
619615
};
620616

621-
const InfoTooltip = ({ children }: { children: ReactNode }) => {
617+
const InfoPopover = ({ children }: { children: ReactNode }) => {
622618
return (
623-
<TooltipProvider>
624-
<Tooltip>
625-
<TooltipTrigger>
626-
<InfoIcon
627-
size={"16px"}
628-
style={{ marginBottom: "-3px", marginLeft: "4px" }}
629-
/>
630-
</TooltipTrigger>
631-
<TooltipContent>{children}</TooltipContent>
632-
</Tooltip>
633-
</TooltipProvider>
619+
<Popover>
620+
<PopoverTrigger>
621+
<InfoIcon
622+
size={"16px"}
623+
style={{ marginBottom: "-3px", marginLeft: "4px" }}
624+
/>
625+
</PopoverTrigger>
626+
<PopoverContent className="text-sm">{children}</PopoverContent>
627+
</Popover>
634628
);
635629
};

0 commit comments

Comments
 (0)