-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathButton.tsx
29 lines (27 loc) · 1.01 KB
/
Button.tsx
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
import type { CSSProperties, FC, MouseEvent, PropsWithChildren, ReactElement } from 'react';
import React from 'react';
export type ButtonProps = PropsWithChildren<{
className?: string;
disabled?: boolean;
endIcon?: ReactElement;
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
startIcon?: ReactElement;
style?: CSSProperties;
tabIndex?: number;
}>;
export const Button: FC<ButtonProps> = (props) => {
return (
<button
className={`wallet-adapter-button ${props.className || ''}`}
disabled={props.disabled}
style={props.style}
onClick={props.onClick}
tabIndex={props.tabIndex || 0}
type="button"
>
{props.startIcon && <i className="wallet-adapter-button-start-icon">{props.startIcon}</i>}
<span className="wallet-adapter-button-span">{props.children}</span>
{props.endIcon && <i className="wallet-adapter-button-end-icon">{props.endIcon}</i>}
</button>
);
};