Skip to content

Commit

Permalink
add vercel logo
Browse files Browse the repository at this point in the history
  • Loading branch information
sallar committed Dec 31, 2022
1 parent c659abf commit ff549f7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ The drawing mechanism lives in [the sallar/github-contributions-canvas repositor
## Install

Install the packages using [NPM](https://nodejs.org/en/):

```
$ npm install
```

## How to run

Running locally:

```
$ npm run dev
```
Expand Down Expand Up @@ -45,3 +47,5 @@ Every release, along with the migration instructions, is documented on the GitHu
## License

[MIT license](https://opensource.org/licenses/MIT)

[![Powered by Vercel](/public/powered-by-vercel.svg)](https://vercel.com/?utm_source=[team-name]&utm_campaign=oss)
6 changes: 6 additions & 0 deletions public/powered-by-vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 23 additions & 14 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React, { useRef, useState, useEffect } from "react";
import { download, uploadToTwitter, fetchData, downloadJSON, cleanUsername } from "../utils/export";
import {
download,
uploadToTwitter,
fetchData,
downloadJSON,
cleanUsername
} from "../utils/export";
import ThemeSelector from "../components/themes";

const App = () => {
Expand All @@ -18,7 +24,7 @@ const App = () => {
draw();
}, [data, theme]);

const handleSubmit = e => {
const handleSubmit = (e) => {
e.preventDefault();

setUsername(cleanUsername(username));
Expand All @@ -27,7 +33,7 @@ const App = () => {
setData(null);

fetchData(cleanUsername(username))
.then(data => {
.then((data) => {
setLoading(false);

if (data.years.length === 0) {
Expand All @@ -37,26 +43,26 @@ const App = () => {
inputRef.current.blur();
}
})
.catch(err => {
.catch((err) => {
console.log(err);
setLoading(false);
setError("I could not check your profile successfully...");
});
};

const onDownload = e => {
const onDownload = (e) => {
e.preventDefault();
download(canvasRef.current);
};

const onDownloadJson = e => {
const onDownloadJson = (e) => {
e.preventDefault();
if (data != null) {
downloadJSON(data);
}
};

const onShareTwitter = e => {
const onShareTwitter = (e) => {
e.preventDefault();
uploadToTwitter(canvasRef.current);
};
Expand Down Expand Up @@ -140,7 +146,7 @@ const App = () => {
<input
ref={inputRef}
placeholder="Your GitHub Username"
onChange={e => setUsername(e.target.value)}
onChange={(e) => setUsername(e.target.value)}
value={username}
id="username"
autoFocus
Expand All @@ -166,12 +172,9 @@ const App = () => {
const _renderDownloadAsJSON = () => {
if (data === null) return;
return (
<a
href="#"
onClick={onDownloadJson}
>
<a href="#" onClick={onDownloadJson}>
<span role="img" aria-label="Bar Chart">
📊
📊
</span>{" "}
Download data as JSON for your own visualizations
</a>
Expand All @@ -189,7 +192,7 @@ const App = () => {
{_renderForm()}
<ThemeSelector
currentTheme={theme}
onChangeTheme={themeName => setTheme(themeName)}
onChangeTheme={(themeName) => setTheme(themeName)}
/>
{_renderGithubButton()}
<footer>
Expand All @@ -204,6 +207,12 @@ const App = () => {
.
</p>
{_renderDownloadAsJSON()}
<a
href="https://vercel.com/?utm_source=[team-name]&utm_campaign=oss"
target="_blank"
>
<img src="/powered-by-vercel.svg" alt="Powered by Vercel" />
</a>
</footer>
</header>
<section className="App-content">
Expand Down

0 comments on commit ff549f7

Please sign in to comment.