Giter Club home page Giter Club logo

github-profile-summary's Introduction

Github Profile Summary

GitHub Workflow Status npm react styled-components babel eslint prettier jest coverage airbnb-style MIT License PRs Welcome

DiegoVictor

Use this component to show a summary of your github stats with a cool design ๐Ÿ˜Ž

Installing

Just run:

npm install @diegovictor/github-profile-summary

Or simply:

yarn add @diegovictor/github-profile-summary

Usage

So easy than make a lemonade:

import React from 'react';
import ReactDOM from "react-dom/client";
import { ProfileSummary } from '@diegovictor/github-profile-summary';
import data from "./data.json";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<ProfileSummary data={data} />,);

Structure

The data attribute must receive an object with the following structure:

{
  user: {
    name: 'Diego Victor',
    avatar_url: 'https://avatars3.githubusercontent.com/u/15165349?v=4',
    login: 'DiegoVictor',
    url: 'https://github.com/DiegoVictor',
  },
  languages: [
    {
      name: 'JS',
      usage: '67%',
      percent: 67,
      color: '#f1e05a',
    },
    ...
  ],
  stats: [
    {
      key: 1,
      title: 'Commit\nAverage',
      value: 59,
      description: 'in 18 repos',
    },
    ...
  ],
}

The stats array must have only 3 items, any item after the third position will be ignored

Field Format Description
user object -
user.name string Utilized as fallback to image in case of it not loads.
user.avatar_url string Avatar's URL.
user.login string Green button label.
user.url string Link to open when the green button is clicked.
languages array -
languages[].name string Language name or alias.
languages[].usage string Language label.
languages[].percent number Language percent usage. Defines language area occupied.
languages[].color string Language color (hexadecimal color code).
stats array -
stats[].key string,number Unique identifier.
stats[].title string Text at the top of stats.
stats[].value number The stat number.
stats[].description string Text at the bottom of the stat.

Data

With in this package there is a script to calcule stats and language usage from a provided github's user, just run scripts/main.js passing the user github's username as parameter:

$ node scripts/main.js diegovictor

Github has a low limit of requests non authenticated, if the provided user have a lot of repositories probably the limit will be reached easyly, to avoid this problem create a personal access token to have a greater limit, then pass it as a second parameter to the script:

$ node scripts/main.js diegovictor ghp_p07LDQ1xUyRJ4dExb6U1YfVlEW1vgX2SKiFQ

A stats.json file will be create aside the script, just copy its content and pass it to component into data attribute.

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.