boxpistols / asagiri-web-react Goto Github PK
View Code? Open in Web Editor NEWAsagiri Web React
Asagiri Web React
現状
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.