forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
36 lines (31 loc) · 863 Bytes
/
index.tsx
File metadata and controls
36 lines (31 loc) · 863 Bytes
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
import React, { FunctionComponent } from 'react';
import { LinkButton, AButton, ReakitButton, styles } from './elements';
type Props = {
to?: string;
href?: string;
big?: boolean;
small?: boolean;
style?: React.CSSProperties;
block?: boolean;
onClick?: (event: React.MouseEvent) => void;
disabled?: boolean;
type?: 'button' | 'reset' | 'submit';
danger?: boolean;
secondary?: boolean;
red?: boolean;
target?: string;
rel?: string;
};
const Button: FunctionComponent<Props> = ({ style = {}, ...props }) => {
// Link
if (typeof props.to === 'string') {
return <LinkButton {...props} style={style} to={props.to} />;
}
if (props.href) {
// @ts-ignore
return <AButton {...props} style={style} />;
}
// @ts-ignore
return <ReakitButton {...props} style={style} />;
};
export { Button, styles as buttonStyles };