use existing component in button
This commit is contained in:
parent
5f7b279bfe
commit
94d6d8a58b
|
@ -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 type { GetProps } from '@tamagui/core'
|
||||||
|
// import { Pressable } from 'react-native'
|
||||||
|
|
||||||
const Base = styled(Stack, {
|
const Base = styled(Stack, {
|
||||||
// tag: 'button',
|
name: 'Button',
|
||||||
|
accessibilityRole: 'button',
|
||||||
|
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
display: 'inline-flex',
|
display: 'inline-flex',
|
||||||
paddingHorizontal: 16,
|
paddingHorizontal: 16,
|
||||||
paddingVertical: 10,
|
paddingTop: 7,
|
||||||
|
paddingBottom: 9,
|
||||||
animation: 'fast',
|
animation: 'fast',
|
||||||
|
userSelect: 'none',
|
||||||
|
|
||||||
variants: {
|
variants: {
|
||||||
type: {
|
type: {
|
||||||
primary: {
|
primary: {
|
||||||
|
@ -27,12 +34,6 @@ const Base = styled(Stack, {
|
||||||
} as const,
|
} as const,
|
||||||
})
|
})
|
||||||
|
|
||||||
const ButtonText = styled(Text, {
|
|
||||||
fontFamily: '$inter',
|
|
||||||
textAlign: 'center',
|
|
||||||
color: '$white-100',
|
|
||||||
})
|
|
||||||
|
|
||||||
type BaseProps = GetProps<typeof Base>
|
type BaseProps = GetProps<typeof Base>
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -46,9 +47,12 @@ const Button = (props: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Base {...rest} type={type} onPress={onPress}>
|
<Base {...rest} type={type} onPress={onPress}>
|
||||||
<ButtonText>{children}</ButtonText>
|
<Paragraph color="$white-100" textAlign="center" weight="medium">
|
||||||
|
{children}
|
||||||
|
</Paragraph>
|
||||||
</Base>
|
</Base>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Button }
|
export { Button }
|
||||||
|
export type { Props as ButtonProps }
|
||||||
|
|
Loading…
Reference in New Issue