refactor: buttons convert to ts

This commit is contained in:
RadoslavDimchev 2023-08-08 09:28:35 +03:00
parent ce712c621b
commit 0bb728eacf
4 changed files with 34 additions and 19 deletions

View File

@ -1,12 +0,0 @@
import { Icon } from '../Icon/Icon'
import { ReactButton } from './ReactButton'
const IconButton = ({ icon, text, ...props }) => {
return (
<ReactButton {...props} icon={<Icon source={icon} />}>
{text}
</ReactButton>
)
}
export default IconButton

View File

@ -0,0 +1,18 @@
import Icon from './Icon'
import ReactButton from './ReactButton'
type IconButtonProps = {
icon: string
children: string
onClick: () => void
}
const IconButton = ({ icon, children, ...props }: IconButtonProps) => {
return (
<ReactButton {...props} icon={<Icon source={icon} />}>
{children}
</ReactButton>
)
}
export default IconButton

View File

@ -1,7 +0,0 @@
import { Button } from 'tamagui'
const ReactButton = ({ children, ...props }) => {
return <Button {...props}>{children}</Button>
}
export default ReactButton

View File

@ -0,0 +1,16 @@
import { Button } from 'tamagui'
import { ReactNode } from 'react'
type ReactButtonProps = {
children: string
style?: unknown
icon?: ReactNode
size?: string
onClick: () => void
}
const ReactButton = ({ children, ...props }: ReactButtonProps) => {
return <Button {...props}>{children}</Button>
}
export default ReactButton