diff --git a/app/application/habits/index.tsx b/app/application/habits/index.tsx index c22ff21..04ce75b 100644 --- a/app/application/habits/index.tsx +++ b/app/application/habits/index.tsx @@ -1,24 +1,58 @@ -import { StyleSheet, Text, View } from "react-native" +import FontAwesome6 from "@expo/vector-icons/FontAwesome6" +import { FlatList, StyleSheet } from "react-native" +import { List } from "react-native-paper" import { SafeAreaView } from "react-native-safe-area-context" import { useHabitsTracker } from "@/presentation/react/contexts/HabitsTracker" +import { colorsPresenter } from "@/presentation/presenters/utils/ColorsPresenter" const HabitsPage: React.FC = () => { const { habitsTracker } = useHabitsTracker() return ( - - {habitsTracker.habitsHistory.map((progressHistory) => { - const { habit } = progressHistory + + + { + const { habit } = item - return ( - - - {habit.name} ({habit.goal.type}) - - - ) - })} + return ( + { + return ( + + ) + }} + /> + ) + }} + /> + ) } @@ -27,7 +61,18 @@ const styles = StyleSheet.create({ container: { flex: 1, alignItems: "center", - justifyContent: "center", + }, + habitsList: { + width: "90%", + }, + habitItem: { + paddingVertical: 20, + paddingHorizontal: 10, + marginVertical: 10, + borderRadius: 10, + }, + habitItemIcon: { + width: 30, }, }) diff --git a/presentation/presenters/utils/ColorsPresenter.ts b/presentation/presenters/utils/ColorsPresenter.ts new file mode 100644 index 0000000..ef299a6 --- /dev/null +++ b/presentation/presenters/utils/ColorsPresenter.ts @@ -0,0 +1,18 @@ +export const colorsPresenter = { + hexToRgbA: (hexColor: string, opacity: number): string => { + let hex = hexColor.replace("#", "") + if (hex.length === 3) { + hex = hex + .split("") + .map((char) => { + return char + char + }) + .join("") + } + const color = Number.parseInt(hex, 16) + const red = (color >> 16) & 255 + const green = (color >> 8) & 255 + const blue = color & 255 + return `rgba(${red}, ${green}, ${blue}, ${opacity})` + }, +}