Skip to content

Commit 791ff91

Browse files
committed
fix: add tooltip to clone button
1 parent 2a40c2d commit 791ff91

2 files changed

Lines changed: 45 additions & 41 deletions

File tree

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from 'react';
22

3-
import { Button, Dialog, Form } from '@douglasneuroinformatics/libui/components';
3+
import { Dialog, Form, Tooltip } from '@douglasneuroinformatics/libui/components';
44
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
55
import { CopyPlusIcon } from 'lucide-react';
66
import { z } from 'zod';
@@ -33,41 +33,46 @@ export const CloneButton = () => {
3333
};
3434

3535
return (
36-
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
37-
<Dialog.Trigger asChild>
38-
<Button className="h-9 w-9" size="icon" variant="outline">
39-
<CopyPlusIcon />
40-
</Button>
41-
</Dialog.Trigger>
42-
<Dialog.Content className="sm:max-w-[475px]">
43-
<Dialog.Header>
44-
<Dialog.Title>Create New Instrument</Dialog.Title>
45-
<Dialog.Description>
46-
This will save the current playground state in local storage as a new instrument.
47-
</Dialog.Description>
48-
</Dialog.Header>
49-
<Form
50-
className="[&_button]:max-w-32"
51-
content={{
52-
label: {
53-
kind: 'string',
54-
label: 'Label',
55-
variant: 'input'
56-
}
57-
}}
58-
submitBtnLabel="Save"
59-
validationSchema={z.object({
60-
label: z
61-
.string()
62-
.min(1)
63-
.refine(
64-
(arg) => !instruments.find((instrument) => instrument.label === arg),
65-
'An instrument with this label already exists'
66-
)
67-
})}
68-
onSubmit={(data) => void handleSubmit(data)}
69-
/>
70-
</Dialog.Content>
71-
</Dialog>
36+
<Tooltip>
37+
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
38+
<Dialog.Trigger asChild>
39+
<Tooltip.Trigger className="h-9 w-9" size="icon" variant="outline">
40+
<CopyPlusIcon />
41+
</Tooltip.Trigger>
42+
</Dialog.Trigger>
43+
<Dialog.Content className="sm:max-w-[475px]">
44+
<Dialog.Header>
45+
<Dialog.Title>Create New Instrument</Dialog.Title>
46+
<Dialog.Description>
47+
This will save the current playground state in local storage as a new instrument.
48+
</Dialog.Description>
49+
</Dialog.Header>
50+
<Form
51+
className="[&_button]:max-w-32"
52+
content={{
53+
label: {
54+
kind: 'string',
55+
label: 'Label',
56+
variant: 'input'
57+
}
58+
}}
59+
submitBtnLabel="Save"
60+
validationSchema={z.object({
61+
label: z
62+
.string()
63+
.min(1)
64+
.refine(
65+
(arg) => !instruments.find((instrument) => instrument.label === arg),
66+
'An instrument with this label already exists'
67+
)
68+
})}
69+
onSubmit={(data) => void handleSubmit(data)}
70+
/>
71+
</Dialog.Content>
72+
</Dialog>
73+
<Tooltip.Content side="bottom">
74+
<p>Create New Instrument</p>
75+
</Tooltip.Content>
76+
</Tooltip>
7277
);
7378
};

apps/playground/src/components/Header/ShareButton/ShareButton.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const ShareButton = () => {
2525

2626
return (
2727
<Tooltip
28-
delayDuration={700}
2928
open={isTooltipOpen}
3029
onOpenChange={(open) => {
3130
if (!isPopoverOpen) {
@@ -52,10 +51,10 @@ export const ShareButton = () => {
5251
<CopyButton size="sm" text={shareURL.href} />
5352
</div>
5453
</Popover.Content>
55-
<Tooltip.Content side="bottom">
56-
<p>Share</p>
57-
</Tooltip.Content>
5854
</Popover>
55+
<Tooltip.Content side="bottom">
56+
<p>Share</p>
57+
</Tooltip.Content>
5958
</Tooltip>
6059
);
6160
};

0 commit comments

Comments
 (0)