Skip to content

Commit fc04911

Browse files
committed
convert to type
1 parent 0e4059c commit fc04911

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

packages/components/src/components/Avatar/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import styled from 'styled-components';
44
import { Element } from '../Element';
55
import { Text } from '../Text';
66

7-
interface IAvatarProps {
7+
type AvatarProps = {
88
user: {
99
id?: string;
1010
username: string;
@@ -13,7 +13,7 @@ interface IAvatarProps {
1313
badges?: any[];
1414
subscriptionSince?: string | null;
1515
};
16-
}
16+
};
1717

1818
export const AvatarContainer = styled(Element).attrs({ as: 'span' })(
1919
css({
@@ -54,7 +54,7 @@ export const Pro = styled(Text).attrs({ size: 1, weight: 'bold' })(
5454
})
5555
);
5656

57-
export const Avatar = ({ user, ...props }: IAvatarProps) =>
57+
export const Avatar = ({ user, ...props }: AvatarProps) =>
5858
user && (
5959
<AvatarContainer {...props}>
6060
<AvatarImage src={user.avatarUrl} alt={user.username} />

packages/components/src/components/Checkbox/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { useId } from '@reach/auto-id';
55
import { Element } from '../Element';
66
import { Text } from '../Text';
77

8-
interface ICheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
8+
type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
99
checked?: boolean;
1010
label?: string;
1111
id?: string;
12-
}
12+
};
1313

1414
export const CheckboxElement = styled.input(
1515
css({
@@ -69,7 +69,7 @@ const Label = styled(Text)(
6969
})
7070
);
7171

72-
export const Checkbox: FunctionComponent<ICheckboxProps> = ({
72+
export const Checkbox: FunctionComponent<CheckboxProps> = ({
7373
checked,
7474
id,
7575
label,

packages/components/src/components/Collapsible/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ const ToggleIcon = props => (
7272
</Icon>
7373
);
7474

75-
interface ICollapsibleProps {
75+
type CollapsibleProps = {
7676
defaultOpen?: boolean;
7777
title: string;
78-
}
78+
};
7979

80-
export const Collapsible: React.FC<ICollapsibleProps> = ({
80+
export const Collapsible: React.FC<CollapsibleProps> = ({
8181
defaultOpen,
8282
title,
8383
children,

packages/components/src/components/FormField/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import VisuallyHidden from '@reach/visually-hidden';
33
import { useId } from '@reach/auto-id';
44
import { Element, Stack, Label } from '../../index';
55

6-
interface IFormFieldProps {
6+
type FormFieldProps = {
77
id?: string;
88
// always ask for a label
99
label: string;
@@ -15,9 +15,9 @@ interface IFormFieldProps {
1515
// elements tree.
1616
hideLabel?: boolean;
1717
direction?: 'horizontal' | 'vertical';
18-
}
18+
};
1919

20-
export const FormField: React.FC<IFormFieldProps> = ({
20+
export const FormField: React.FC<FormFieldProps> = ({
2121
label,
2222
id,
2323
hideLabel = false,

packages/components/src/components/Input/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const placeholderStyles = {
77
fontSize: 3,
88
};
99

10-
interface IInputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
10+
type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
1111

12-
export const Input = styled(Element).attrs({ as: 'input' })<IInputProps>(
12+
export const Input = styled(Element).attrs({ as: 'input' })<InputProps>(
1313
css({
1414
height: '26px',
1515
width: '100%',

packages/components/src/components/Switch/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ const SwitchContainer = styled(Element)(
5151
})
5252
);
5353

54-
interface ISwitchProps {
54+
type SwitchProps = {
5555
id?: string;
5656
on?: boolean;
5757
defaultOn?: boolean;
5858
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
59-
}
59+
};
6060

61-
export const Switch: React.FC<ISwitchProps> = ({ on, defaultOn, ...props }) => (
61+
export const Switch: React.FC<SwitchProps> = ({ on, defaultOn, ...props }) => (
6262
<SwitchContainer as="label">
6363
<SwitchInput
6464
type="checkbox"

packages/components/src/components/Textarea/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import Rect from '@reach/rect';
55
import VisuallyHidden from '@reach/visually-hidden';
66
import { Stack, Input, Text } from '../..';
77

8-
interface ITextareaProps
9-
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
8+
type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
109
maxLength?: number;
1110
autosize?: boolean;
1211
value?: string;
1312
defaultValue?: string;
14-
}
13+
};
1514

1615
export const TextareaComponent: any = styled(Input).attrs({
1716
as: 'textarea',
@@ -37,7 +36,7 @@ const Count = styled.div<{ limit: boolean }>(({ limit }) =>
3736
})
3837
);
3938

40-
export const Textarea: React.FC<ITextareaProps> = ({
39+
export const Textarea: React.FC<TextareaProps> = ({
4140
maxLength,
4241
defaultValue = '',
4342
value = '',

0 commit comments

Comments
 (0)