1.1.55 โ€ข Published 1 year ago

@raulcanodev/react-github-dots v1.1.55

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

โœจ React GitHub Dots

Hey! ๐Ÿ‘‹ This is a React component that creates the GitHub's green dots contribution graph. Perfect for spicing up your portfolio or tracking activity in a visually appealing way!

npm version license

Compatible with React Compatible with Next.js

SCR-20250105-oixx

โœจ About this package

  • ๐Ÿ“Š Beautiful GitHub-style contribution visualization
  • ๐ŸŒ“ Seamless light and dark mode support
  • ๐ŸŽจ Make it yours with custom color schemes
  • ๐Ÿ”„ Real-time GitHub data at your fingertips
  • ๐Ÿ“ฑ Looks great on any screen size
  • โšก๏ธ Smart caching for optimal performance

๐Ÿš€ Getting Started

  1. Pop this into your terminal:
npm install @raulcanodev/react-github-dots
  1. Within your React app:
import ContributionGraph from '@raulcanodev/react-github-dots';

function App() {
  return (
    <ContributionGraph 
      username="your-github-username"
      token="your-github-token"
      theme="dark" // or "light"
      cacheTime="8h" // Cache data for 8 hours
    />
  );
}

For Next.js 13+ (App Router), add the client directive:

'use client';
import ContributionGraph from '@raulcanodev/react-github-dots';

export default function Page() {
  return (
    <ContributionGraph 
      username="your-github-username"
      token="your-github-token"
      theme="dark"
      cacheTime="1d"
    />
  );
}

๐ŸŽ› Configuration Options

Here's what you can tweak:

PropTypeDefaultWhat it does
usernamestringrequiredYour GitHub username
tokenstringrequiredYour GitHub access token
theme'light' | 'dark''dark'Pick your style
customColorSchemeobjectnullCustom colors
loadingComponentReactNodenullCustom loading state
cacheTimefalse | '2h' | '8h' | '1d''1d'Control data caching duration

๐ŸŽจ Customize The Dot Colors

Want your own color scheme? Here's how:

<ContributionGraph 
  username="your-github-username"
  token="your-github-token"
  customColorScheme={{
    0: '#ebedf0', // No contributions
    1: '#ff9b9b', // 1-3 contributions
    2: '#ff4040', // 4-6 contributions
    3: '#ff0000', // 7-9 contributions
    4: '#990000'  // 10+ contributions
  }}
/>

โšก๏ธ Cache Control

Optimize performance with smart caching:

// Disable caching - always fetch fresh data
<ContributionGraph 
  username="your-github-username"
  token="your-github-token"
  cacheTime={false}
/>

// Cache for 2 hours
<ContributionGraph 
  username="your-github-username"
  token="your-github-token"
  cacheTime="2h"
/>

// Cache for 8 hours
<ContributionGraph 
  username="your-github-username"
  token="your-github-token"
  cacheTime="8h"
/>

// Cache for 1 day (default)
<ContributionGraph 
  username="your-github-username"
  token="your-github-token"
  cacheTime="1d"
/>

๐Ÿ›  Development & Contributions

Getting Set Up

  1. Grab the code:
git clone https://github.com/raulcanodev/react-github-dots.git
cd react-github-dots
  1. Install what you need:
npm install
  1. Build it:
npm run watch

๐Ÿงช Testing Locally

  1. Link your package locally, which allows you to test it in other projects:
npm link
  1. Create a new React app and link the component:
npx create-react-app test-github-dots
cd test-github-dots
npm install react react-dom
npm link @raulcanodev/react-github-dots
  1. In your App.jsx, import and use:
import ContributionGraph from '@raulcanodev/react-github-dots';

๐Ÿ”„ Development Flow

Want to see changes in real-time? Here's how:

  1. In your package directory:
npm run watch
  1. In your test app:
npm run dev

Need to refresh the link for any bug? Try:

npm unlink @raulcanodev/react-github-dots
npm link @raulcanodev/react-github-dots

๐Ÿ”‘ Getting Your GitHub Token

You'll need a GitHub Personal Access Token with read:user scope. Get one here: https://github.com/settings/tokens?type=beta

๐Ÿ“ License

MIT ยฉ Raul Cano


Made with โค๏ธ by Raul Cano. Questions? Issues? Feel free to reach out!

Want to contribute? PRs are always welcome! ๐Ÿ™Œ

1.1.55

1 year ago

1.1.54

1 year ago

1.1.53

1 year ago

1.1.51

1 year ago

1.1.50

1 year ago

1.1.49

1 year ago

1.1.48

1 year ago

1.1.47

1 year ago

1.1.46

1 year ago

1.1.45

1 year ago

1.1.44

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

1.1.39

1 year ago

1.1.38

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.35

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago