Skip to content

Commit 6505075

Browse files
committed
🏷️ Move React type definitions to type files
1 parent f2a146e commit 6505075

File tree

21 files changed

+59
-61
lines changed

21 files changed

+59
-61
lines changed

src/components/Alert/Alert.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import type { AlertProps } from './alert'
2+
import type { ReactAlertProps } from './alert'
33
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
44

55
import info from '../../icons/info.svg?raw'
@@ -16,13 +16,6 @@ const iconMap = {
1616
alert
1717
}
1818

19-
type ReactAlertProps = {
20-
Element?: keyof JSX.IntrinsicElements
21-
TitleTag?: keyof JSX.IntrinsicElements
22-
children: React.ReactNode
23-
icon?: string
24-
} & AlertProps
25-
2619
const Alert = ({
2720
Element = 'section',
2821
title,

src/components/Alert/alert.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ export type AlertProps = {
1010
| 'alert'
1111
| null
1212
}
13+
14+
export type ReactAlertProps = {
15+
Element?: keyof JSX.IntrinsicElements
16+
TitleTag?: keyof JSX.IntrinsicElements
17+
children: React.ReactNode
18+
} & Omit<AlertProps, 'titleTag' | 'element'>

src/components/Badge/Badge.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import React from 'react'
2-
import type { BadgeProps } from './badge'
2+
import type { ReactBadgeProps } from './badge'
33
import './badge.scss'
44

5-
type ReactBadgeProps = {
6-
children: React.ReactNode
7-
} & BadgeProps
8-
95
const Badge = ({ theme, onClick, children, ...rest }: ReactBadgeProps) => {
106
const classes = [
117
'w-badge',

src/components/Badge/badge.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ export type BadgeProps = {
99
| null
1010
onClick?: () => any
1111
}
12+
13+
export type ReactBadgeProps = {
14+
children: React.ReactNode
15+
} & BadgeProps

src/components/Button/Button.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import React from 'react'
2-
import type { ButtonProps } from './button'
2+
import type { ReactButtonProps } from './button'
33
import './button.scss'
44

5-
type ReactButtonProps = {
6-
children: React.ReactNode
7-
} & ButtonProps
8-
95
const Button = ({
106
theme,
117
bold,

src/components/Button/button.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ export type ButtonProps = {
1212
onClick?: () => any
1313
[key: string]: any
1414
}
15+
16+
export type ReactButtonProps = {
17+
children: React.ReactNode
18+
} & ButtonProps

src/components/Card/Card.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import React from 'react'
2-
import type { CardProps } from './card'
2+
import type { ReactCardProps } from './card'
33
import './card.scss'
44

5-
type ReactCardProps = {
6-
Element?: keyof JSX.IntrinsicElements
7-
TitleTag?: keyof JSX.IntrinsicElements
8-
children: React.ReactNode
9-
} & CardProps
10-
115
const Card = ({
126
Element = 'section',
137
title,

src/components/Card/card.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ export type CardProps = {
77
secondary?: boolean
88
[key: string]: any
99
}
10+
11+
export type ReactCardProps = {
12+
Element?: keyof JSX.IntrinsicElements
13+
TitleTag?: keyof JSX.IntrinsicElements
14+
children: React.ReactNode
15+
} & Omit<CardProps, 'titleTag' | 'element'>

src/components/Checkbox/Checkbox.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import React from 'react'
2-
import type { CheckboxProps } from './checkbox'
2+
import type { ReactCheckboxProps } from './checkbox'
33
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
44

55
import check from '../../icons/check.svg?raw'
66

77
import './checkbox.scss'
88

9-
type ReactCheckboxProps = {
10-
onClick?: (key: any) => any
11-
} & CheckboxProps
12-
139
const Checkbox = ({
1410
checked,
1511
label,

src/components/Checkbox/checkbox.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ export type CheckboxProps = {
66
boxed?: boolean
77
color?: string
88
}
9+
10+
export type ReactCheckboxProps = {
11+
onClick?: (key: any) => any
12+
} & CheckboxProps

0 commit comments

Comments
 (0)