-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathtool-button.tsx
More file actions
49 lines (47 loc) · 1.03 KB
/
tool-button.tsx
File metadata and controls
49 lines (47 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import type { ReactNode } from 'react';
interface ToolButtonProps {
title: string;
icon: ReactNode;
onClick: () => void;
className?: string;
disabled?: boolean;
'data-testid'?: string;
}
export function ToolButton({
title,
icon,
onClick,
className,
disabled = false,
'data-testid': testId,
}: ToolButtonProps) {
return (
<button
type="button"
aria-label={title}
title={title}
onClick={onClick}
disabled={disabled}
data-testid={testId}
className={className}
style={{
width: '42px',
height: '42px',
backgroundColor: '#ffffff',
borderRadius: '4px',
boxShadow: '0 0 0 2px rgba(0,0,0,0.1)',
border: 'none',
cursor: disabled ? 'default' : 'pointer',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: 0,
opacity: disabled ? 0.4 : 1,
}}
>
<span aria-hidden={true} style={{ display: 'flex' }}>
{icon}
</span>
</button>
);
}