react-github-heatmap
v1.0.7
Published
A plugable React component to display a general purpose GitHub-like contributions graph
Downloads
12
Maintainers
Readme
react-github-heatmap
A plugable React component to display a general purpose GitHub-like contributions graph based on SVG.
📦 Install
npm i react-github-heatmap
yarn add react-github-heatmap
🔨 Usage
Take a glance at the docs to see further examples 😉.
import React from 'react';
import { Heatmap, HeatmapData } from 'react-github-heatmap';
import { api } from './api';
const App = () => {
const [data, setData] = React.useState<HeatmapData>();
const [isLoading, setIsLoading] = useState(false);
React.useEffect(() => {
fetchData();
}, []);
const fetchData = async () => {
setIsLoading(true);
await api
.getData()
.then(data => {
setData(data);
})
.catch(error => {
alert(error.message);
})
.finally(() => setIsLoading(false));
};
return (
<>
{isLoading && <span>Loading...</span>}
{data && <Heatmap data={data} />}
</>
);
};
🚧 Development directions
- Clone this repo:
git clone [email protected]:marcelovicentegc/react-github-heatmap.git
- Install dependencies:
yarn
- Build the app:
yarn build
- Change directory into
example
and install its dependencies:cd example && yarn
- From inside the
example
folder, start the app:yarn start