Coder Social home page Coder Social logo

cesarherr / to_do_list Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 374 KB

"To-do list" is a tool for organizing your day. It allows you to create a simple list of tasks and mark them as complete when done. This particular To-do list is built using modern technologies like ES6 and Webpack. It goes beyond just task management by incorporating functions testing with Jest, making it a comprehensive and robust project.

Home Page: https://cesarherr.github.io/To_do_List/dist/

License: MIT License

JavaScript 92.12% CSS 7.88%
javascript jest-test webpack

to_do_list's People

Contributors

cesarherr avatar redmarverick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

to_do_list's Issues

Don't Repeat Yourself

this.displayList();
this.enterEvent();

  • This lines are unnecessary

addRemoveBtnListeners() {
mainList.addEventListener('click', (event) => {
if (event.target.classList.contains('remove-btn')) {
const index = event.target.dataset.listIndex;
this.remove(index);
}
});
mainList.addEventListener('click', (event) => {
if (event.target.classList.contains('fa-trash-can')) {
const button = event.target.closest('.remove-btn');
button.click();
}
});
}

  • You can work just whit the image, and your code will be shorter.

Html best practice

<body>
<div class="container">
<div class="header">
<h1>Today´s To Do</h1>
<i class="fa-solid fa-arrows-rotate fa-rotate-90"></i>
</div>
<label for="text" aria-labelledby="text"></label>
<input class="add" type="text" name="text" placeholder="Add to your list...">
<ul class="tasks">
<!-- To do list here -->
</ul>
<button class="clear">Clear all completed</button>
</div>
</body>

  • Use the appropriate tags for each element, you can use 'header' and 'section' over div's.

Avoid Unnecessary Variables

To_do_List/src/index.js

Lines 6 to 16 in 042256f

const addToDo = document.querySelector('.add');
document.addEventListener('keyup', (event) => {
const activity = document.querySelector('.add').value;
if (event.code === 'Enter') {
if (activity !== '') {
toDoList.add(activity);
toDoList.displayList();
addToDo.value = '';
}

  • Don't create new variables if you don't plan to save values, you can try: document.querySelector('.add').value = ""

To_do_List/src/index.js

Lines 33 to 34 in 042256f

const taskDescription = document.querySelectorAll('.taskElement');
taskDescription[index].classList.toggle('line-through');

  • Same issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.