Skip to content

Commit

Permalink
🏷️ Improve component types
Browse files Browse the repository at this point in the history
  • Loading branch information
Frontendland committed Sep 30, 2024
1 parent 4638ed1 commit d7ccb77
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/components/Breadcrumb/breadcrumb.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { ButtonProps } from '../Button/button'

export type BreadcrumbProps = {
items: {
icon?: string
label?: string
href?: string
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop'
target?: ButtonProps['target']
}[]
separator?: string
className?: string
Expand Down
5 changes: 3 additions & 2 deletions src/components/Button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export type ButtonProps = {
| 'alert'
| null
href?: string
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop' | undefined
className?: string
[key: string]: any
}

export type SvelteButtonProps = {
onClick?: (() => any) | null
onClick?: ((event: MouseEvent) => void) | null
} & ButtonProps

export type ReactButtonProps = {
onClick?: (() => any) | null
onClick?: (event: React.MouseEvent) => void
children: React.ReactNode
} & ButtonProps
4 changes: 2 additions & 2 deletions src/components/Checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export type CheckboxProps = {
}

export type SvelteCheckboxProps = {
onClick?: (key: any) => any
onClick?: ((event: MouseEvent) => void) | null
} & CheckboxProps

export type ReactCheckboxProps = {
onClick?: (key: any) => any
onClick?: (event: React.MouseEvent) => void
} & CheckboxProps
4 changes: 3 additions & 1 deletion src/components/Footer/footer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { ButtonProps } from '../Button/button'

export type FooterProps = {
logo?: {
url?: string
Expand All @@ -12,7 +14,7 @@ export type FooterProps = {
items: {
href: string
name: string
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop'
target?: ButtonProps['target']
active?: boolean
}[]
}[]
Expand Down
4 changes: 3 additions & 1 deletion src/components/List/list.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { ButtonProps } from '../Button/button'

export type ListEventType = {
value: string
name: string
Expand All @@ -19,7 +21,7 @@ export type ListProps = {
name: string
value?: string
href?: string
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop'
target?: ButtonProps['target']
selected?: boolean
disabled?: boolean
icon?: string
Expand Down
4 changes: 3 additions & 1 deletion src/components/Menu/menu.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { ButtonProps } from '../Button/button'

export type MenuProps = {
items?: {
href: string
name: string
target?: string
target?: ButtonProps['target']
active?: boolean
}[]
logo?: {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Rating/rating.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { ButtonProps } from '../Button/button'

export type RatingProps = {
score: number
total?: number
Expand All @@ -8,7 +10,7 @@ export type RatingProps = {
reviewCount?: number
reviewText?: string
reviewLink?: string
reviewTarget?: string
reviewTarget?: ButtonProps['target']
color?: string
emptyColor?: string
size?: number
Expand Down
4 changes: 2 additions & 2 deletions src/components/Switch/switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export type SwitchProps = {
}

export type SvelteSwitchProps = {
onClick?: (key: any) => any
onClick?: ((event: MouseEvent) => void) | null
} & SwitchProps

export type ReactSwitchProps = {
onClick?: (key: any) => any
onClick?: (event: React.MouseEvent) => void
} & SwitchProps

0 comments on commit d7ccb77

Please sign in to comment.