Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
# 🖥️ Mission-FE-Zero100
FE Zero100 미션을 위한 레포지토리입니다.

Expand Down
70 changes: 69 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"



},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
"react-dom": "^19.0.0",
"react-router-dom": "^7.4.1"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
Expand Down
55 changes: 38 additions & 17 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
import "./index.css";
import Text from "./component/Text";
import Input from "./component/Input";
import Button from "./component/Button";
import Checkbox from "./component/Checkbox";
import styled from "styled-components";
import Header from "./component/Header";
import AddTodo from "./component/AddTodo";
import Category from "./component/Category";
import TodoList from "./component/TodoList";
import { useState } from "react";

const Container = styled.div`
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f9f9f9;

@media (max-width: 768px) and (orientation: portrait) {
max-width: 90%;
padding: 1.5rem;
}

@media (max-width: 480px) and (orientation: portrait) {
padding: 1rem;
}
`;

function App() {
return (
<div className="app-container">
{/* text part */}
<Text />
const [todos, setTodos] = useState([]);
const [activeCategory, setActiveCategory] = useState("All");

const handleAddTodo = (text) => {
if (text.trim() === "") return;
const newTodo = { id: Date.now(), text, completed: false };
setTodos([...todos, newTodo]);
};

{/* input part */}
<Input />
{/* button part */}
<Button />
{/* checkbox part */}
<Checkbox />
</div>
return (
<Container>
<Header />
<AddTodo onAddTodo={handleAddTodo} />
<Category activeCategory={activeCategory} setActiveCategory={setActiveCategory} />
<TodoList todos={todos} setTodos={setTodos} activeCategory={activeCategory} />
</Container>
);
}
};

export default App;
58 changes: 0 additions & 58 deletions src/Blocks.jsx

This file was deleted.

59 changes: 59 additions & 0 deletions src/component/AddTodo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React, { useState } from 'react';
import styled from "styled-components";

const AddTodoContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
`;

const StyledText = styled.h2`
text-align: center;
display: flex;
`;

const StyledInput = styled.input`
width: 500px;
padding: 14px;
border-radius: 0px;
margin-bottom: 8px;
`;
Comment on lines +16 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input 컴포넌트를 사용하지 않으시고, 새로 생성하셨네요!
Input, Button, Text와 같이 공통 컴포넌트를 만드셨으니, 해당 컴포넌트들을 활용하는 것이 좋을 것 같아요!


const StyledButton = styled.button`
background-color: black;
color: white;
width: 532px;
padding: 9px;
border: none;
border-radius: 0px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0px로 주시는 건, 아무것도 지정하지 않은 상태와 동일하기 때문에 굳이 명시하실 필요 없습니다!

margin-bottom: 8px;
`;

const AddTodo = ({ onAddTodo }) => {
const [inputValue, setInputValue] = useState("");

const handleInputChange = (e) => {
setInputValue(e.target.value);
};

const handleAddClick = () => {
onAddTodo(inputValue);
setInputValue("");
};

return(
<AddTodoContainer>
<StyledText>What needs to be done?</StyledText>
<StyledInput
type="text"
placeholder="Add a task"
value={inputValue}
onChange={handleInputChange}
/>
<StyledButton onClick={handleAddClick}>Add</StyledButton>
</AddTodoContainer>
)
}

export default AddTodo;
13 changes: 0 additions & 13 deletions src/component/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@
import React from 'react'

const Button = ({label, onClick}) => {
return (
<div className="filters">
<button>Show all tasks</button>
<button>Show active tasks</button>
<button>Show completed tasks</button>
</div>
)
}

export default Button;
35 changes: 35 additions & 0 deletions src/component/Category.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { useState } from 'react';
import styled from "styled-components";

const CategoryContainer = styled.div`
display: flex;
justify-content: center;
gap: 8px;
`;

const StyledButton = styled.button`
width: 130px;
padding: 7px;
background-color: white;
border: 2px solid ${(props) => (props.active ? "black" : "#ccc")};
border-radius: 0px;
font-size: 14px;
`;

const Category = ({ activeCategory, setActiveCategory }) => {
return (
<CategoryContainer>
{["All", "Active", "Completed"].map((label) => (
<StyledButton
key={label}
active={activeCategory === label}
onClick={() => setActiveCategory(label)}
>
{label}
</StyledButton>
))}
</CategoryContainer>
);
};

export default Category;
Loading