Code Monkey home page Code Monkey logo

advent-of-vue-2022-gift-search-bar's Introduction

Advent Of Vue 2022 - Gift Search Bar

It's my first time properly playing with Vue 3's Composition API here.

My own personal TODOs:

  • findProducts implementation
  • Debounce
  • Loading and error states (I chose to forgoe alert)
  • Style it up with some product cards
    • Thumbnails
    • Price
    • Discount sticker
    • Star rating
  • Load more / pagination
  • No results

What I learned:

  • composition API basics
    • reference vs ref
    • SFC <script setup>
  • some TailwindCSS basics
    • how to add and extend the colour palette

Forked README below 👇🏻

If you didn't get here from an email, read this section! Skip it otherwise.

Advent Of Vue is a series of 24 Vue coding challenges that are sent out every day from December 1 to December 24 via a dedicated newsletter. If you'd like to receive more of these puzzles in the future, go ahead and sign up!

Problem description

You're tasked with building a debounced search bar for products from DummyJSON's product API. In case you're not familiar with the concept of debouncing, it's a technique that allows one to delay a function's execution until a specific amount of time has elapsed since the last call.

For this challenge, you'll need to add a 300-millisecond delay to the findProducts function. You can make use of readily available debounce implementations, or try writing one yourself.

You'll also need to display a generic loading spinner/message, and if the function executes successfully, place suggested products' names and price tags inside an unordered list. Otherwise, use native alert() to show a generic error message.

If the search term gets reset back to an empty string, clear the search suggestions too.

Recording of an example solution

https://youtu.be/avf8OyNDJfo

Author

Maciej Pędzich (Mac):

Credits

DummyJSON project by Muhammad Ovi.

Based on a Stackblitz project by tony19

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.