In this project, let’s build a Github Popular Repos by applying the concepts we have learned till now.

Refer to the images below:

github popular repos output

Failure View

github popular repos failure view output

Design Files

Click to view

Set Up Instructions

Click to view
  • Download dependencies by running npm install
  • Start up the app using npm start

Completion Instructions

Functionality to be added

The app must have the following functionalities

  • When the app is opened initially,

    • An HTTP GET request should be made to githubReposApiUrl with query parameter as language and its initial value as ALL
    • loader should be displayed while fetching the data
    • After the data is fetched successfully, display the repositories list received in the response
  • When a language filter is active

    • An HTTP GET request should be made to the above-mentioned URL with the id of the active language
    • loader should be displayed while fetching the data
    • After the data is fetched successfully, display the repositories list received in the response
  • The GithubPopularRepos component is provided with languageFiltersData. It consists of a list of language filter objects with the following properties in each language filter object

    Key Data Type
    id String
    language String
API Requests & Responses

githubReposApiUrl

API: https://apis.ccbp.in/popular-repos

Example: https://apis.ccbp.in/popular-repos?language=ALL

Method: GET

Description:

Returns a response containing the list of repositories

Response

{
  "popular_repos": [
    {
	  "name": "freeCodeCamp",
      "id": 28457823,
      "issues_count": 154,
      "forks_count": 26651,
      "stars_count": 331304,
      "avatar_url": "https://avatars.githubusercontent.com/u/9892522?v=4"
    }, 
      ...
  ],
}
Components Structure

component-breakdown-structure

Implementation Files

Use these files to complete the implementation:

  • src/components/GithubPopularRepos/index.js
  • src/components/GithubPopularRepos/index.css
  • src/components/LanguageFilterItem/index.js
  • src/components/LanguageFilterItem/index.css
  • src/components/RepositoryItem/index.js
  • src/components/RepositoryItem/index.css

Quick Tips

Click to view

  • To display the animated loader, we need to import the Loader component using the below statement

    import Loader from 'react-loader-spinner'
  • In order to display the given animated loader, pass the type and color props to the Loader component with values as ThreeDots and #0284c7, respectively

    <Loader type="ThreeDots" color="#0284c7" height={80} width={80} />

Important Note

Click to view

The following instructions are required for the tests to pass

  • Wrap the Loader component with an HTML container element and add the testid attribute value as loader to it

    <div testid="loader">
       <Loader type="ThreeDots" color="#0284c7" height={80} width={80} />
    </div>

Resources

Image URLs
Colors

Hex: #0284c7
Hex: #ffffff
Hex: #0f172a
Hex: #f8f8ff
Hex: #e73959
Hex: #1e293b
Font-families
  • Roboto
  • Lobster

Things to Keep in Mind

  • All components you implement should go in the src/components directory.
  • Don’t change the component folder names as those are the files being imported into the tests.
  • Do not remove the pre-filled code
  • Want to quickly review some of the concepts you’ve been learning? Take a look at the Cheat Sheets.

GitHub

View Github