refactor: rest icon components to tsx

This commit is contained in:
RadoslavDimchev 2023-08-08 09:40:51 +03:00
parent 0bb728eacf
commit 67898225d1
2 changed files with 10 additions and 4 deletions

View File

@ -1,9 +1,10 @@
import { Image } from 'tamagui' import { Image } from 'tamagui'
type IconProps = { export type IconProps = {
source: string source: string
width?: number width?: number
height?: number height?: number
style?: unknown
} }
const Icon = ({ source, width = 16, height = 16, ...props }: IconProps) => { const Icon = ({ source, width = 16, height = 16, ...props }: IconProps) => {

View File

@ -1,7 +1,12 @@
import { Paragraph, XStack } from 'tamagui' import { Paragraph, XStack } from 'tamagui'
import { Icon } from '../Icon/Icon' import Icon from './Icon'
const IconText = ({ icon, text, ...props }) => { type IconTextProps = {
icon: string
children: string
}
const IconText = ({ icon, children, ...props }: IconTextProps) => {
return ( return (
<XStack <XStack
style={{ style={{
@ -11,7 +16,7 @@ const IconText = ({ icon, text, ...props }) => {
> >
<Icon source={icon} width={16} height={16} /> <Icon source={icon} width={16} height={16} />
<Paragraph {...props} color={'#000000'}> <Paragraph {...props} color={'#000000'}>
{text} {children}
</Paragraph> </Paragraph>
</XStack> </XStack>
) )