feat: create button component
This commit is contained in:
parent
cb87e0c37c
commit
5dec1645bd
2 changed files with 39 additions and 0 deletions
34
src/components/Button.tsx
Normal file
34
src/components/Button.tsx
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { ButtonSpinner, Button as GSButton, Text } from "@gluestack-ui/themed";
|
||||||
|
import { ComponentProps } from "react";
|
||||||
|
|
||||||
|
type Props = ComponentProps<typeof GSButton> & {
|
||||||
|
title: string,
|
||||||
|
isLoading?: boolean,
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Button({ title, isLoading = false, ...others }: Props) {
|
||||||
|
return (
|
||||||
|
<GSButton
|
||||||
|
w="$full"
|
||||||
|
h="$14"
|
||||||
|
bg="$green700"
|
||||||
|
rounded="$sm"
|
||||||
|
borderColor="$green500"
|
||||||
|
$active-bg="$green500"
|
||||||
|
disabled={isLoading}
|
||||||
|
{...others}
|
||||||
|
>
|
||||||
|
{ isLoading ? (
|
||||||
|
<ButtonSpinner color="$white" />
|
||||||
|
) : (
|
||||||
|
<Text
|
||||||
|
color="$white"
|
||||||
|
fontFamily="$heading"
|
||||||
|
fontSize="$sm"
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</GSButton>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ import { Center, Heading, Image, Text, VStack } from "@gluestack-ui/themed";
|
||||||
import BackgroundImg from '@assets/background.png';
|
import BackgroundImg from '@assets/background.png';
|
||||||
import Logo from '@assets/logo.svg';
|
import Logo from '@assets/logo.svg';
|
||||||
import { Input } from "@components/Input";
|
import { Input } from "@components/Input";
|
||||||
|
import { Button } from "@components/Button";
|
||||||
|
|
||||||
export function SignIn() {
|
export function SignIn() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -41,6 +42,10 @@ export function SignIn() {
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
title="Acessar"
|
||||||
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
</VStack>
|
</VStack>
|
||||||
</VStack>
|
</VStack>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue