File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
apps/webapp/app/components/primitives Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,25 @@ import { useCopy } from "~/hooks/useCopy";
4
4
import { Button } from "./Buttons" ;
5
5
import { SimpleTooltip } from "./Tooltip" ;
6
6
7
+ const sizes = {
8
+ "extra-small" : {
9
+ icon : "size-3" ,
10
+ button : "h-5 px-1" ,
11
+ } ,
12
+ small : {
13
+ icon : "size-3.5" ,
14
+ button : "h-6 px-1" ,
15
+ } ,
16
+ medium : {
17
+ icon : "size-4" ,
18
+ button : "h-8 px-1.5" ,
19
+ } ,
20
+ } ;
21
+
7
22
type CopyButtonProps = {
8
23
value : string ;
9
24
variant ?: "icon" | "button" ;
10
- size ?: "small" | "medium" ;
25
+ size ?: keyof typeof sizes ;
11
26
className ?: string ;
12
27
buttonClassName ?: string ;
13
28
showTooltip ?: boolean ;
@@ -25,16 +40,15 @@ export function CopyButton({
25
40
} : CopyButtonProps ) {
26
41
const { copy, copied } = useCopy ( value ) ;
27
42
28
- const iconSize = size === "small" ? "size-3.5" : "size-4" ;
29
- const buttonSize = size === "small" ? "h-6" : "h-8" ;
43
+ const { icon : iconSize , button : buttonSize } = sizes [ size ] ;
30
44
31
45
const button =
32
46
variant === "icon" ? (
33
47
< span
34
48
onClick = { copy }
35
49
className = { cn (
36
50
buttonSize ,
37
- "flex items-center justify-center rounded border border-charcoal-650 bg-charcoal-750 px-1.5 " ,
51
+ "flex items-center justify-center rounded border border-charcoal-650 bg-charcoal-750" ,
38
52
copied
39
53
? "text-green-500"
40
54
: "text-text-dimmed hover:border-charcoal-600 hover:bg-charcoal-700 hover:text-text-bright" ,
@@ -49,7 +63,7 @@ export function CopyButton({
49
63
</ span >
50
64
) : (
51
65
< Button
52
- variant = { `${ buttonVariant } /${ size } ` }
66
+ variant = { `${ buttonVariant } /${ size === "extra-small" ? "small" : size } ` }
53
67
onClick = { copy }
54
68
className = { cn ( "shrink-0" , buttonClassName ) }
55
69
>
Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ function DateTimeTooltipContent({
295
295
< Paragraph variant = "extra-small" className = "text-text-dimmed" >
296
296
{ dateTime }
297
297
</ Paragraph >
298
- < CopyButton value = { isoDateTime } variant = "icon" size = "small" showTooltip = { false } />
298
+ < CopyButton value = { isoDateTime } variant = "icon" size = "extra- small" showTooltip = { false } />
299
299
</ div >
300
300
</ div >
301
301
) ;
You can’t perform that action at this time.
0 commit comments