Giter VIP home page Giter VIP logo

atlas-islands-lab's Introduction

Atlas of Remote Islands: A React Lab

Completed App

The Goal

This lab is based on the book Atlas of Remote Islands: Fifty Islands I Have Never Set Foot On and Never Will by Judith Schalansky. The book describes 50 remote islands from around the world; data about those islands has been collected into the src/atlas-of-remote-islands.js file. Your goal is to represent the islands as options on a travel-like site.

NOTE: A geographic map and a .map() method are two different things, and the meanings can get a little muddled if you aren't careful. The reason the .map() method is named how it is - each item in the new array corresponds to (maps to) an item in the original array. For our purposes, we're going to be careful to use the phrase .map() when we mean the method, and Map when we mean the geographic representation.

Getting Started

  1. Clone this repository using git clone
  2. cd into the project folder
  3. npm install
  4. npm start

The Lab

  1. Note that App.js is importing the data from atlas-of-remote-islands.js, and there is a console.log(data) as part of App.js. Open the Developer Tools in your browser and explore the data object.

  2. One card has already been componentized for you. Use .map() to update App.js so that it generates a card for each entry in data.islands.

It's ok if the cards don't yet have any data in them, but there should be a total of 50 cards.

  1. Update your .map() function to pass data about each island to each card as props. You can console.log(props) in Card.js to check that props are being passed.

  2. From Card.js, pass props to the <CardInfo /> component for the island name, description, latitude, longitude, and Wikipedia link.

  3. Display the island name, description, latitude, and longitude in the card. Then pass the Wikipedia link as a prop to the <WikiButton /> component, and set the href for the <a> tag around the button. Clicking on each button should open that island's Wikipedia page in a new tab.

  4. Pass the image URL to <CardImage /> component, and check that CardImage.js is receiving it.

  5. Use inline styling to set the backgroundImage of the <div> with className=card-image as the image passed to <CardImage /> via props.

Extensions

Google Maps Component

  1. Add a new component to each card that renders a Google Map of each island (see above). There are several ways to do this!

Hint: you can use the latitude and longitude along with Google Maps' <embed> code; also, set the width of the embed to 100% to fill the container.

Depending on how you've accomplished this, consider commenting out this component while you work on the remaining tasks so you're not re-rendering the maps each time.

  1. Update the interface to group cards by their region: Arctic Ocean, Atlantic Ocean, Indian Ocean, Pacific Ocean, Antarctic Ocean. How might you pre-process the data in order to get a list of all unique regions?

Hint: consider how you might use the .filter() method to populate cards in each section.

  1. Add an option that sorts islands (a) alphabetically by name (A to Z), or (b) by page number (lowest to highest). Store the choice in state and apply the sort to each region.

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.