Giter VIP home page Giter VIP logo

gifeed's Introduction

Gifeed

This simple web application performs one of two operations: query the Giphy API with the provided input, or show the current top 10 gifs if nothing is typed. The challenge here was to avoid using a full sized framework and keep the code as lightweight as possible. That's how I ended up implementing (and getting to know) RxJS.

Approach to problem

To help me conceptualize the design and subdivide into tasks, I had to ask myself the following questions:

  1. What is there?
  2. How does it work?
  3. How does it look?

What is there?

At the very least, there is an input tag and a container for the gifs. The gif elements, which are actually videos in order to avoid watermarks, are created on the fly and appended to the grid after the requests return from Giphy. Thinking about it that way seems obvious, but it does help destructure the application and delegate the element creation to javascript.

How does it work?

A query to Giphy's Search API is made whenever the user stops typing. If the input tag is left blank, the query will be made to Giphy's Trending API. Such query will also be made right after loading the application for the first time.

Traditionally, I'd go with a Vue or React template project to take care of binding the input tag contents with an AJAX request. However, that sounds and feels like an overkill. I felt like this was the time to finally dip my toes in the world of observables.

I stumbled upon this post How to build a search bar with RxJS and tailored the code to the needs of the project. Since it is a fairly straight forward solution, I had to comment the code in order to soldify my understanding of the new concepts I was dealing with. As one more seasoned frontend developer once told (warned) me, observables will open your mind to new ways of designing and thinking about web applications. Now I can barely, but firmly, confirm that affirmation.

How does it look?

Returned gifs are laid out in a three column grid with no unnecessary white space as a result of rendering elements with different heights. (a little bit like Pinterest)

Masonry helps you deal with that kind of requirement.

Takeaways

• The simpler the application, the more easily flaws are noticed.

• RxJS is a game changer and I plan to dive deeper into it.

• Masonry may have been too much for this project.

Nice to haves:

• X Button to clear the input field. It could also have a small label that reads "Top 10".

• Infinite scroll, of course.

• Gradient background?.

• Pinning the search bar to the Masonry grid so that the elements will flow around it.

gifeed's People

Contributors

vzalberto avatar

Watchers

James Cloos 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.