Skip to content

Commit c31ed7b

Browse files
committed
Fix types
1 parent d56b49f commit c31ed7b

File tree

5 files changed

+30
-23
lines changed

5 files changed

+30
-23
lines changed

packages/common/src/components/Button/elements.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import React from 'react';
2-
import styled, { css } from 'styled-components';
1+
import React, { ComponentProps } from 'react';
32
import { Link } from 'react-router-dom';
4-
import { Button as ReakitButton } from 'reakit/Button';
3+
import { Button as ReakitButtonBase } from 'reakit/Button';
4+
import styled, { css } from 'styled-components';
5+
56
import theme from '../../theme';
6-
import { IButtonProps } from '.';
77
import { withoutProps } from '../../utils';
88

9+
import { Button } from '.';
10+
911
export type OptionProps = {
1012
theme: any;
1113
disabled?: boolean;
@@ -102,7 +104,7 @@ const getBorder = ({
102104
return '2px solid #66B9F4';
103105
};
104106

105-
export const styles = css<IButtonProps | any>`
107+
export const styles = css<ComponentProps<typeof Button> | any>`
106108
transition: 0.3s ease all;
107109
font-family: Poppins, Roboto, sans-serif;
108110
@@ -160,6 +162,6 @@ export const LinkButton = styled(withoutProps(`small`)(Link))`
160162
export const AButton = styled(withoutProps(`small`)(props => <a {...props} />))`
161163
${styles};
162164
`;
163-
export const Button = styled(withoutProps(`small`)(ReakitButton))`
165+
export const ReakitButton = styled(withoutProps(`small`)(ReakitButtonBase))`
164166
${styles}
165167
`;

packages/common/src/components/Button/index.tsx

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

3-
import { LinkButton, AButton, Button as ButtonBase, styles } from './elements';
3+
import { LinkButton, AButton, ReakitButton, styles } from './elements';
44

55
type Props = {
66
to?: string;
@@ -28,7 +28,7 @@ const Button: FunctionComponent<Props> = ({ style = {}, ...props }) => {
2828
return <AButton {...props} style={style} />;
2929
}
3030

31-
return <ButtonBase {...props} style={style} />;
31+
return <ReakitButton {...props} style={style} />;
3232
};
3333

3434
export { Button, styles as buttonStyles };

packages/common/src/components/Modal/Modal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import React from 'react';
1+
import React, { ComponentProps } from 'react';
22
import {
33
useDialogState,
44
DialogDisclosure,
55
DialogBackdrop,
66
Dialog,
77
} from 'reakit/Dialog';
88
import { Portal } from 'reakit/Portal';
9-
import { Button, IButtonProps } from '../Button';
9+
import { Button } from '../Button';
1010
import { Backdrop, Container } from './elements';
1111

12-
export interface IModalProps extends IButtonProps {
12+
export interface IModalProps extends ComponentProps<typeof Button> {
1313
label?: string;
1414
button?: React.ElementType;
1515
backdrop?: React.ElementType;

packages/common/src/components/MultiAction/elements.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import styled, { css } from 'styled-components';
1+
import { ComponentProps } from 'react';
2+
import { Button as ReakitButton } from 'reakit/Button';
23
import { Group } from 'reakit/Group';
3-
import { Button } from 'reakit/Button';
44
import { Menu, MenuItem, MenuDisclosure } from 'reakit/Menu';
5-
import { IButtonProps, buttonStyles } from '../Button';
5+
import styled, { css } from 'styled-components';
6+
7+
import { Button, buttonStyles } from '../Button';
68

79
export const Container = styled(Group)`
810
position: relative;
911
display: flex;
1012
`;
1113

12-
export const PrimaryAction = styled(Button)<IButtonProps>`
14+
export const PrimaryAction = styled(ReakitButton)<
15+
ComponentProps<typeof Button>
16+
>`
1317
${({ block }) => css`
1418
${buttonStyles};
1519
justify-content: center;
@@ -21,7 +25,9 @@ export const PrimaryAction = styled(Button)<IButtonProps>`
2125
`}
2226
`;
2327

24-
export const ToggleActionsList = styled(MenuDisclosure)<IButtonProps>`
28+
export const ToggleActionsList = styled(MenuDisclosure)<
29+
ComponentProps<typeof Button>
30+
>`
2531
${buttonStyles};
2632
justify-content: center;
2733
width: 32px;

packages/common/src/components/ProgressButton/index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import React from 'react';
2-
import { Button, IButtonProps } from '../Button';
1+
import React, { ComponentProps, FunctionComponent } from 'react';
2+
import { Button } from '../Button';
33
import { Wrapper, Loader } from './elements';
44

5-
interface IProgressButtonProps extends IButtonProps {
5+
type Props = ComponentProps<typeof Button> & {
66
loading?: boolean;
7-
}
8-
9-
const ProgressButton: React.FC<IProgressButtonProps> = ({
10-
loading = false,
7+
};
8+
const ProgressButton: FunctionComponent<Props> = ({
119
disabled = false,
10+
loading = false,
1211
...props
1312
}) => (
1413
<Wrapper>

0 commit comments

Comments
 (0)