feat: create group component
This commit is contained in:
parent
2cd1564e36
commit
cfa8cb395f
2 changed files with 48 additions and 0 deletions
37
src/components/Group.tsx
Normal file
37
src/components/Group.tsx
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
import { Button, Text } from "@gluestack-ui/themed";
|
||||||
|
import { ComponentProps } from "react"
|
||||||
|
|
||||||
|
type Props = ComponentProps<typeof Button> & {
|
||||||
|
name: string,
|
||||||
|
isActive: boolean,
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Group({ name, isActive, ...others }: Props) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
minWidth="$24"
|
||||||
|
h="$10"
|
||||||
|
bg="$gray600"
|
||||||
|
rounded="$md"
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
borderColor="$green500"
|
||||||
|
borderWidth={isActive ? 1 : 0}
|
||||||
|
sx={{
|
||||||
|
":active": {
|
||||||
|
borderWidth: 1,
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
{...others}
|
||||||
|
>
|
||||||
|
<Text
|
||||||
|
color={isActive ? "$green500" : "$gray200"}
|
||||||
|
fontSize="$xs"
|
||||||
|
textTransform="uppercase"
|
||||||
|
fontFamily="$heading"
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</Text>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,21 @@
|
||||||
import { HomeHeader } from "@components/HomeHeader";
|
import { HomeHeader } from "@components/HomeHeader";
|
||||||
|
import { Group } from "@components/Group";
|
||||||
import { VStack } from "@gluestack-ui/themed";
|
import { VStack } from "@gluestack-ui/themed";
|
||||||
|
|
||||||
export function Home() {
|
export function Home() {
|
||||||
return (
|
return (
|
||||||
<VStack flex={1}>
|
<VStack flex={1}>
|
||||||
<HomeHeader />
|
<HomeHeader />
|
||||||
|
|
||||||
|
<Group
|
||||||
|
name="Costas"
|
||||||
|
isActive
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Group
|
||||||
|
name="Peito"
|
||||||
|
isActive={false}
|
||||||
|
/>
|
||||||
</VStack>
|
</VStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue