Code Monkey home page Code Monkey logo

notify's Introduction

SEI-Project-02: Hackathon

Technologies used

  • Javascript
  • React
  • Axios
  • SCSS
  • Bulma
  • HTML
  • Git
  • GitHub

Overview

Link to project

  • Project two was a 2 day hackathon to build a React application that consumes a public API. It was a paired project.

Brief

  • Build a React application that consumes a public API
  • The React app must have at least one classical and one functional
  • The app should include a router with several pages
  • Have semantically clean HTML
  • Be deployed online and accessible to the public

Timeframe

  • 2 days

Home Page

Home Page

Process

we decided we wanted to use a music or events API so after looking into numerous API documentations, we decided to use Deezer's API. Once we had an idea of what we wanted our frontend to consist of, we began by building components for the home page, navbar, album index and finally album show page.

To begin with we hard coded everything so the only artist displayed was Coldplay. Once we had this working we worked on the search bar to return any artist the user searches for (see below in challenges for more info on this).

Search results

Search result

We then worked on the styling, using SCSS to complement the basic Bulma styling. Finally, we added a loading gif in a loading component.

The whole project was coded together on one laptop, something I really enjoyed and found particularly beneficial learning off one another.

Wins

  • One major win from this project was getting used to accessing nested data within APIs
  • Another win was mapping over arrays, as we did in the example below, to get the tracklisting and track previews from Deezer's API
<ul>
  {this.state.album.tracks.data.map(track =>
    <li key={track.id}>
      <h4 className="title is-4">{track.title}</h4>
      <audio src={track.preview} controls />
    </li>)}
</ul>

Challenges

  • The biggest challenge was the search bar, setting the search value data to state and then transferring this data from the navbar component to the albumsindex component via props.

Navbar.js:

handleSearch(e) {
  this.setState({ data: e.target.value })
}

handleSubmit(e) {
  e.preventDefault()
  this.props.history.push(`/search/${this.state.data}`)
}

AlbumsIndex.js:

getData() {
  axios.get('https://cors-anywhere.herokuapp.com/api.deezer.com/search/album', {
    params: {
      q: this.props.match.params.query
    }
  })
    .then(res => {
      console.log(res.data)
      this.setState({ albums: res.data.data })
    })
}

Future Features

  • Something we'd have loved to do if we had longer is to have random featured artists on the home page, rather than having eight artists picked by the team.

notify's People

Contributors

dsandor87 avatar dependabot[bot] 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.