Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project-todos-context-vite #24

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
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
18 changes: 0 additions & 18 deletions .gitignore

This file was deleted.

35 changes: 12 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
<h1 align="center">
<a href="">
<img src="./src/assets/banner.svg" alt="Project Banner Image">
</a>
</h1>

# Todo - useContext Project

Replace this readme with your own information about your project.
## Getting Started with the Project

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.

## Getting Started with the Project

### Dependency Installation & Startup Development Server
This weeks project was to do an To-Do App. In the app you can add tasks to a list, I've set a maximum of 10 tasks at a time. Once completed you check the box and the task will be overlined, you can also choose to remove a task.

Once cloned, navigate to the project's root directory and this project uses npm (Node Package Manager) to manage its dependencies.
### The Problem

The command below is a combination of installing dependencies, opening up the project on VS Code and it will run a development server on your terminal.
How did you plan?
It was fun to have free hands on this weeks project. Although, that made it quite difficult to decide on what to do. Decided to go simple and went for a To-Do list design/approach that I personally could use as a weekly planner.

```bash
npm i && code . && npm run dev
```
If you had more time, what would be next?
With more time I would have added date/time to the To-Do tasks. I would have added a component for notes were the user can write down information more freely. Also would have liked to add a "complete all-button" to the To-Do list that targets all tasks.

### The Problem
What technologies did you use?
State hooks such as useState were used to manage data within each component, such as to-do tasks, reminder text, workout days, etc.
Event handling functions were implemented to handle user interactions like adding/removing tasks, toggling task completion, setting reminders, etc.

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?
Setting the date in ListName.jsx and ReminderBlock.jsx might not be showing as it should on phone views.

### View it live

Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
https://majestic-moxie-414767.netlify.app/

## Instructions

<a href="instructions.md">
See instructions of this project
</a>
73 changes: 0 additions & 73 deletions instructions.md

This file was deleted.

Binary file not shown.
7 changes: 0 additions & 7 deletions pull_request_template.md

This file was deleted.

50 changes: 49 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
import { useState } from "react";
import { TodoProvider } from "./Components/TodoContext/TodoContext.jsx";
import { ListName } from "./Components/ListName/ListName.jsx";
import { TodoList } from "./Components/TodoList/TodoList.jsx";
import { WorkoutBlock } from "./Components/Workout/WorkoutBlock.jsx";

Choose a reason for hiding this comment

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

The naming conventions could be improved for consistency and clarity. For example, some components and CSS classes use camelCase while others use kebab-case.

import { StickyNote } from "./Components/StickyNote/StickyNote.jsx"; // Import StickyNote
import "./index.css";

export const App = () => {
return <div>Find me in App.jsx!</div>;
const [isWorkoutBlockVisible, setIsWorkoutBlockVisible] = useState(true);

const toggleWorkoutBlockVisibility = () => {
setIsWorkoutBlockVisible(!isWorkoutBlockVisible);
};

return (
<TodoProvider>
<div>
<h1>To-Do App</h1>
</div>
<div className="container">
<div className="left-block">
<TodoList />
</div>
<div className="right-block">
<div className="first-block">
<ListName />
</div>
<div
className={`second-block ${
isWorkoutBlockVisible ? "expanded" : "collapsed"
}`}
>
<div className="second-block-content">
{isWorkoutBlockVisible && <WorkoutBlock />}
</div>
<button
className="toggle-button"
onClick={toggleWorkoutBlockVisibility}
>
{isWorkoutBlockVisible ? "−" : "+"}
</button>
</div>
<div className="third-block">
<StickyNote />
</div>
</div>
</div>
</TodoProvider>
);
};
41 changes: 41 additions & 0 deletions src/Components/ListName/ListName.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.listname-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
}

.listname-container h2 {
font-family: "Poltawski Nowy", sans-serif;
font-size: 25px;
color: #382e2c;
margin: auto;
margin-top: 10px;
}

.listname-container input {
font-family: "Raleway", sans-serif;
font-size: 18px;
color: #695853;
margin-left: 10px;
cursor: pointer;
border: 1px solid #9a9086;
border-radius: 10px;
padding: 6px 10px;
}

.listname-container input:focus {
outline: 1px solid #695853;
}

/* Media Query */
@media (max-width: 480px) {
.listname-container h2 {
font-size: 18px;
}

.listname-container input {
font-size: 14px;
}
}
60 changes: 60 additions & 0 deletions src/Components/ListName/ListName.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { useState } from "react";
import "./ListName.css";

export const ListName = () => {
// State to store the list name and date
const [listName, setListName] = useState("Weekly planner");
const [date, setDate] = useState("");

// Handler to update the list name
const handleListNameChange = (event) => {
setListName(event.target.value);
};

// Handler to update the date
const handleDateChange = (event) => {
setDate(event.target.value);
};

// Function to clear default text when input is clicked
const clearDefaultText = (stateSetter, defaultText) => {
if (stateSetter === listName) {
if (listName === defaultText) {
setListName("");
}
} else if (stateSetter === date) {
if (date === defaultText) {
setDate("");
}
}
};

return (
<div className="listname-container">
<div className="input-group">
<h2>
<label htmlFor="listName">List name:</label>
<input
type="text"
id="listName"
value={listName}
onChange={handleListNameChange}
onClick={() => clearDefaultText(listName, "Weekly planner")}
/>
</h2>
</div>
<div className="input-group">
<h2>
<label htmlFor="date">Date:</label>
<input
type="week"
id="date"
value={date}
onChange={handleDateChange}
onClick={() => clearDefaultText(date, "")}
/>
</h2>
</div>
</div>
);
};
Loading