GithubHelp home page GithubHelp logo

kevin-mwole / todo Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 588 KB

Todo app focusing on accessibility, built with NextJS, Typescript and TDD

Home Page: https://todo-amber-psi.vercel.app/todos

TypeScript 77.92% JavaScript 15.01% CSS 4.59% SCSS 2.48%

todo's Introduction

Todo app

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

Todo app in dark mode showing a list of todos, some completed, some active

Built with

What I learned

Building out the functional logic and semantic markup in a single component allowed me to focus on getting everything working. This could serve as an MVP so at every stage after that there was a working deliverable product. Using React Testing Library to test all of the key actions (displaying a list of todos, creating todos, completing a todo) from this beginning stage, meant that I had a suite of regression tests to give confidence in the subsequent development.

Once the core app was in place I could experiment with breakdowns of the components, ultimately separating out the containing page from a set of feature components that implemented the business logic and core app styling. Using Styled Components meant I could keep the key styles co-located with each component.

I extracted some reusable components that were not specific to any business logic. For instance an <IconButton>, a custom styled <Checkbox> and a polymorphic <Link> component, rendering an <a> or a <button> depending on wheter it received href or onClick props. These components could form the basis of a design system if this app was extended in future. Building in correct accessibility features (such as appropriately linked <label> elements, and enforcing label text props via Typescript) into these reusable components, makes it easy for developers consuming them to provide an accessible experience with no additional effort.

One approach that I would change on similar projects in the future is to build robust remote data handling from the beginning. In this project I started with mock data in a simple hard-coded array. I then created functions that could mock a remote data store using localstorage. This worked fine, but made some of the automated tests more difficult to write, and it differs significantly to how the app would communicate with a real server. Instead I chose to implement MockServiceWorker (MSW) and ReactQuery. MSW allowed me to set up route handlers that match the API routes that would be used in production, and ReactQuery then takes care of all of the fetching and caching of that data for use in the app. When time comes to switch the app over to production, nothing else in the app would need to change, it can immediately start to consume the real API. This had a secondary advantage in the automated tests. Test data can be provided directly to MSW, meaning none of the actual front-end app needs to be mocked, giving excellent confidence that everything works as expected.

Continued development

In future projects I'd like to explore animation more, particularly animating SVGs.

I would also like to learn how to effectively use a screen reader. In this project I was able to test the app is accessible by keyboard, and check that appropriate roles and labels are present. But I would like to be more confortable with testing other accessibility aspects of the app.

Links

todo's People

Contributors

kevin-mwole avatar

Watchers

 avatar

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.