Git Product home page Git Product logo

asagiri-web-react's Introduction

Hi there 👋

I am UIUX Engineer

Anurag's GitHub stats

asagiri-web-react's People

Contributors

boxpistols avatar

Stargazers

 avatar

Watchers

 avatar

asagiri-web-react's Issues

Axios Data Result to View

現状

import React from "react"
import PropTypes from "prop-types"
import { useEffect, useState } from "react"
import axios from "axios"

function Skill(props) {
  const [languageList, setLanguageList] = useState([])
  console.log(languageList)

  useEffect(() => {
    // 非同期でデータを取得 TODO: 100以上 over 1handred repos API
    axios
      .get("https://api.github.com/users/BoxPistols/repos?per_page=50")
      .then((response) => {
        // dataから、言語リストを配列で入れる
        const languageList = response.data.map((res) => res.language)
        // 引数でそのままカウント関数に渡す
        const countedLanguageList = generateLanguageCountObj(languageList)
        setLanguageList(countedLanguageList)
      })
  }, [])

  // 全ての言語
  const generateLanguageCountObj = (allLanguageList) => {
    // 整形処理 null以外
    const notNullLanguageList = allLanguageList.filter(
      (language) => language != null
    )
    //重複を省いた新たな配列の生成
    const uniqueLanguageList = [...new Set(notNullLanguageList)]
    // ユニークな言語リスト 評価する
    return uniqueLanguageList.map((item) => {
      return {
        language: item,
        // 言語の数の計算 ex. ['JavaScript', 'JavaScript', ...]
        count: allLanguageList.filter((language) => language === item).length,
      }
    })
  }

  const converseCountToPercentage = (count) => {
    if (count > 7) {
      return <span className="big">80</span>
    }
    return count * 10
  }

  return (
    <>
      <div id="skills">
        <div className="container">
          <div className="heading">
            <h2>Skills</h2>
            <ul>
              {languageList.map((item, index) => (
                <li key={index} className="description">
                  {index + 1}: {item.language} /{" "}
                  <b>{converseCountToPercentage(item.count)} %</b>
                </li>
              ))}
            </ul>
          </div>
          <div className="skills-container"></div>
        </div>
      </div>
    </>
  )
}

Skill.propTypes = {
  name: PropTypes.string,
}

export default Skill

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.