|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import TodoList from "@/components/TodoList"; |
|
|
|
|
import TodoList from "@/components/todo-list"; |
|
|
|
|
import { Button, ButtonText } from "@/components/ui/button"; |
|
|
|
|
import { GS } from "@/components/ui/gluestack-ui-provider/gluestack-ui-token"; |
|
|
|
|
import { HStack } from "@/components/ui/hstack"; |
|
|
|
@ -7,11 +7,12 @@ import { Text } from "@/components/ui/text"; |
|
|
|
|
import { VStack } from "@/components/ui/vstack"; |
|
|
|
|
import { useTodosCtx } from "@/store/todoProvider"; |
|
|
|
|
import { useState } from "react"; |
|
|
|
|
import { KeyboardAvoidingView, Platform } from "react-native"; |
|
|
|
|
import { KeyboardAvoidingView, Platform, View } from "react-native"; |
|
|
|
|
import { SafeAreaView } from "react-native-safe-area-context"; |
|
|
|
|
|
|
|
|
|
export default function ActiveTab() { |
|
|
|
|
const { activeTodos, leftCount, add, toggle, completeAll } = useTodosCtx(); |
|
|
|
|
const { todos, activeTodos, leftCount, add, toggle, completeAll, clearDone } = |
|
|
|
|
useTodosCtx(); |
|
|
|
|
const [title, setTitle] = useState(""); |
|
|
|
|
|
|
|
|
|
const onAdd = () => { |
|
|
|
@ -20,16 +21,12 @@ export default function ActiveTab() { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<SafeAreaView style={{ flex: 1 }} className="bg-white dark:bg-neutral-900"> |
|
|
|
|
<KeyboardAvoidingView |
|
|
|
|
style={{ flex: 1 }} |
|
|
|
|
behavior={Platform.OS === "ios" ? "padding" : "height"} |
|
|
|
|
keyboardVerticalOffset={30} |
|
|
|
|
> |
|
|
|
|
<VStack className="flex-1 px-4 py-1 gap-3"> |
|
|
|
|
<SafeAreaView className="flex-1 px-4 py-1 bg-white dark:bg-neutral-900"> |
|
|
|
|
<VStack className="flex-1 gap-3"> |
|
|
|
|
<HStack className="flex justify-between"> |
|
|
|
|
<Text className="text-2xl font-bold">할 일</Text> |
|
|
|
|
{/* 확인 창 */} |
|
|
|
|
<TodoList data={activeTodos} onToggle={toggle} /> |
|
|
|
|
</HStack> |
|
|
|
|
|
|
|
|
|
{/* 입력 창 */} |
|
|
|
|
<HStack className="gap-2"> |
|
|
|
|
<Input className="flex-1"> |
|
|
|
@ -45,8 +42,17 @@ export default function ActiveTab() { |
|
|
|
|
<ButtonText>추가</ButtonText> |
|
|
|
|
</Button> |
|
|
|
|
</HStack> |
|
|
|
|
|
|
|
|
|
{/* 확인 창 */} |
|
|
|
|
<TodoList data={todos} onToggle={toggle} /> |
|
|
|
|
<Button |
|
|
|
|
variant={GS.variant.outline} |
|
|
|
|
action={GS.action.secondary} |
|
|
|
|
onPress={clearDone} |
|
|
|
|
> |
|
|
|
|
<ButtonText>완료한 일 모두 지우기</ButtonText> |
|
|
|
|
</Button> |
|
|
|
|
</VStack> |
|
|
|
|
</KeyboardAvoidingView> |
|
|
|
|
</SafeAreaView> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|