Skip to content

ereljapco/fem-todo-app-main

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Todo app solution

Netlify Status

This is a solution to the Todo app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the app depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Add new todos to the list
  • Mark todos as complete
  • Delete todos from the list
  • Filter by all/active/complete todos
  • Clear all completed todos
  • Toggle light and dark mode
  • Bonus: Drag and drop to reorder items on the list

Screenshot

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • Mobile-first workflow
  • BEM - CSS methodology
  • React - JS library

What I learned

  • Getting preferred color scheme of the user
window
  .matchMedia('(prefers-color-scheme: dark)')
  .addEventListener('change', (e) =>
    e.matches ? setDarkTheme(true) : setDarkTheme(false)
  );
  • Responsive sizing using clamp() has a computation

Instead of computing for all sizing (font-size, margin, etc.), I utilized Marc Bacon's Clamp() Function Calculator. I used clamp() from screen width 768px because it wasn't giving the right size on mobile view (375px).

  • Utilizing useState instead of using useEffect
const getFilteredTodos = (todos, filter) => {
  if (filter === 'active') {
    return todos.filter((todo) => !todo.isComplete);
  } else if (filter === 'completed') {
    return todos.filter((todo) => todo.isComplete);
  } else {
    return todos;
  }
};

const visibleTodos = getFilteredTodos(todoList, filterBy);

Continued development

Useful resources

Author