refactor: convert all title components

This commit is contained in:
RadoslavDimchev 2023-08-08 10:50:32 +03:00
parent 94fbbb6f15
commit f00d26e955
7 changed files with 21 additions and 11 deletions

View File

@ -1,6 +1,6 @@
import { Text } from 'tamagui' import { Text } from 'tamagui'
type TextElement = { export type TextElement = {
text: string text: string
bold?: boolean bold?: boolean
italic?: boolean italic?: boolean

View File

@ -5,6 +5,7 @@ export type IconProps = {
width?: number width?: number
height?: number height?: number
style?: unknown style?: unknown
className?: string
} }
const Icon = ({ source, width = 16, height = 16, ...props }: IconProps) => { const Icon = ({ source, width = 16, height = 16, ...props }: IconProps) => {

View File

@ -2,9 +2,12 @@ import Icon from './Icon'
import ReactButton from './ReactButton' import ReactButton from './ReactButton'
type IconButtonProps = { type IconButtonProps = {
icon: string
children: string children: string
onClick: () => void icon: string
style?: unknown
size?: string
fontSize?: string
onClick?: () => void
} }
const IconButton = ({ icon, children, ...props }: IconButtonProps) => { const IconButton = ({ icon, children, ...props }: IconButtonProps) => {

View File

@ -6,7 +6,7 @@ type ReactButtonProps = {
style?: unknown style?: unknown
icon?: ReactNode icon?: ReactNode
size?: string size?: string
onClick: () => void onClick?: () => void
} }
const ReactButton = ({ children, ...props }: ReactButtonProps) => { const ReactButton = ({ children, ...props }: ReactButtonProps) => {

View File

@ -1,9 +1,14 @@
import { XStack, YStack } from 'tamagui' import { XStack, YStack } from 'tamagui'
import { SubTitle } from './SubTitle' import Title from './Title'
import { Title } from './Title' import SubTitle from './SubTitle'
import { IconButton } from './IconButton' import IconButton from './IconButton'
const Titles = ({ title, subtitle }) => { type TitlesProps = {
title: string
subtitle: string
}
const Titles = ({ title, subtitle }: TitlesProps) => {
return ( return (
<YStack> <YStack>
<XStack justifyContent="space-between"> <XStack justifyContent="space-between">
@ -12,13 +17,14 @@ const Titles = ({ title, subtitle }) => {
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
border: '1px solid #DCE0E5', border: '1px solid #DCE0E5',
color: '#09101C',
}} }}
color={'#09101C'}
size={'$3'} size={'$3'}
icon={'/icons/reveal.png'} icon={'/icons/reveal.png'}
text={'Advanced Settings'}
fontSize={'$5'} fontSize={'$5'}
/> >
Advanced Settings
</IconButton>
</XStack> </XStack>
<SubTitle color={'#09101C'}>{subtitle}</SubTitle> <SubTitle color={'#09101C'}>{subtitle}</SubTitle>
</YStack> </YStack>