feat: add group list
This commit is contained in:
parent
cfa8cb395f
commit
498c955e4b
2 changed files with 25 additions and 8 deletions
|
|
@ -22,6 +22,7 @@ export function Group({ name, isActive, ...others }: Props) {
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
mr="$3"
|
||||||
{...others}
|
{...others}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,37 @@
|
||||||
|
import { useState } from "react";
|
||||||
|
import { FlatList, HStack, VStack } from "@gluestack-ui/themed";
|
||||||
|
|
||||||
import { HomeHeader } from "@components/HomeHeader";
|
import { HomeHeader } from "@components/HomeHeader";
|
||||||
import { Group } from "@components/Group";
|
import { Group } from "@components/Group";
|
||||||
import { VStack } from "@gluestack-ui/themed";
|
|
||||||
|
|
||||||
export function Home() {
|
export function Home() {
|
||||||
|
const [groups, setGroups] = useState<string[]>(['costas', 'bíceps', 'tríceps', 'ombro', 'peito', 'pernas'])
|
||||||
|
const [selectedGroup, setSelectedGroup] = useState("costas");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<VStack flex={1}>
|
<VStack flex={1}>
|
||||||
<HomeHeader />
|
<HomeHeader />
|
||||||
|
|
||||||
|
<FlatList
|
||||||
|
data={groups}
|
||||||
|
keyExtractor={(item) => item as string}
|
||||||
|
renderItem={({ item }) => (
|
||||||
<Group
|
<Group
|
||||||
name="Costas"
|
name={item as string}
|
||||||
isActive
|
isActive={selectedGroup === item}
|
||||||
|
onPress={() => setSelectedGroup(item as string)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
horizontal
|
||||||
|
showsHorizontalScrollIndicator={false}
|
||||||
|
contentContainerStyle={{ marginHorizontal: 32 }}
|
||||||
|
style={{
|
||||||
|
marginVertical: 40,
|
||||||
|
maxHeight: 44,
|
||||||
|
minHeight: 44,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Group
|
|
||||||
name="Peito"
|
|
||||||
isActive={false}
|
|
||||||
/>
|
|
||||||
</VStack>
|
</VStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue