GithubHelp home page GithubHelp logo

beccasheldon / react-autocomplete Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 666 KB

Bootstrapped create-react-app focused on an autocomplete component that takes in a user search query and returns possible results from an api.

HTML 3.12% JavaScript 63.40% CSS 33.48%

react-autocomplete's Introduction

This is a bootstrapped create-react-app focused on an autocomplete component that takes in a user search query and returns possible results from an api.

Design:

  • Simple, responsive UI.
  • Clear UX for searching, seeing results, and seeing selected result.

Logic:

Request Parameters & URL:
Parameter Effect
search Limits the results to items with names that match search.
authorization Takes a username and password to check if request is authorized by the API.
These events trigger the request:
  • A character is typed into the input field.
The server returns back:
  • First 10 matches to the search query.
  • Count of all matching results.
  • URL for getting the next page of results.

The UI handles these things:

  • Clearing the state and the UI of all results when one result is clicked on.
  • Showing the result clicked in a Card /> component that could be used to show details and handle adding to cart.
  • Clearing the selected item when a new search starts in the input field.

Running Locally:

  1. git clone https://github.com/BeccaSheldon/react-autocomplete.git
  2. cd react-autocomplete
  3. Update ~/react-autocomplete/src/components/config/CredentialsExample.json with your credentials and rename the file to Credentials.json
  4. run yarn start

Screenshots:

Improvement List:

  • Highlight search query in the list of found results.
  • Add results count to the list of found results.
  • Add ability to view more possibilites in the list of found results (just needs page number update in the api url + pagination UI).
  • Handle case when no results are found.
  • Cut down number of API calls by requiring three letters before query is considered valid or just waiting half a second for typing to stop (or some other rule).
  • Cache results on the client for some amount of time (would also cut down number of requests).
  • Add component transitions and fun interactions.
  • Improve copy to be more on-brand and more interesting.
  • Improve design to be more on-brand.
  • Add tests!

Thanks for taking the time to check out this repo and README!

react-autocomplete's People

Contributors

beccasheldon avatar

Watchers

 avatar  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.