use existing component in button

This commit is contained in:
Pavel Prichodko 2023-01-18 16:41:45 +01:00
parent 5f7b279bfe
commit 94d6d8a58b
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 14 additions and 10 deletions

View File

@ -1,16 +1,23 @@
import { Stack, styled, Text } from '@tamagui/core'
import { Stack, styled } from '@tamagui/core'
import { Paragraph } from '../typography'
import type { GetProps } from '@tamagui/core'
// import { Pressable } from 'react-native'
const Base = styled(Stack, {
// tag: 'button',
name: 'Button',
accessibilityRole: 'button',
cursor: 'pointer',
borderRadius: 12,
display: 'inline-flex',
paddingHorizontal: 16,
paddingVertical: 10,
paddingTop: 7,
paddingBottom: 9,
animation: 'fast',
userSelect: 'none',
variants: {
type: {
primary: {
@ -27,12 +34,6 @@ const Base = styled(Stack, {
} as const,
})
const ButtonText = styled(Text, {
fontFamily: '$inter',
textAlign: 'center',
color: '$white-100',
})
type BaseProps = GetProps<typeof Base>
type Props = {
@ -46,9 +47,12 @@ const Button = (props: Props) => {
return (
<Base {...rest} type={type} onPress={onPress}>
<ButtonText>{children}</ButtonText>
<Paragraph color="$white-100" textAlign="center" weight="medium">
{children}
</Paragraph>
</Base>
)
}
export { Button }
export type { Props as ButtonProps }