|
| 1 | +# RepoWidget |
| 2 | + |
| 3 | +[](https://github.com/peterbenoit/RepoWidget) |
| 4 | +[](https://github.com/peterbenoit/RepoWidget/blob/main/LICENSE) |
| 5 | +[](https://repowidget.vercel.app/) |
| 6 | + |
| 7 | +A professional GitHub repository display widget for showcasing repositories on any website. RepoWidget makes it easy to embed and display GitHub repositories in a customizable, responsive layout without any dependencies. |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Features |
| 12 | + |
| 13 | +- 🔍 Display repositories from any GitHub user or organization |
| 14 | +- 🎨 Fully customizable styling and appearance |
| 15 | +- 📱 Responsive design with configurable column layouts |
| 16 | +- ⚡ Zero dependencies, lightweight and fast |
| 17 | +- 🔄 Sort repositories by stars, forks, or last update date |
| 18 | +- 🧩 Simple integration with any website |
| 19 | +- 🌐 Works with vanilla JavaScript or any framework |
| 20 | + |
| 21 | +## Demo & Examples |
| 22 | + |
| 23 | +Visit our [demo page](https://repowidget.vercel.app/) to see RepoWidget in action. |
| 24 | + |
| 25 | +### Example Use Cases |
| 26 | + |
| 27 | +- [Company Open Source Page](https://repowidget.vercel.app/examples/company.html) - Showcase your company's open source projects |
| 28 | +- [Documentation Hub](https://repowidget.vercel.app/examples/documentation-hub.html) - Display relevant repositories in documentation |
| 29 | +- [Developer Portfolio](https://repowidget.vercel.app/examples/portfolio.html) - Highlight your personal projects |
| 30 | + |
| 31 | +## Quick Start |
| 32 | + |
| 33 | +### Option 1: Direct Script Include |
| 34 | + |
| 35 | +```html |
| 36 | +<div id="my-github-repos"></div> |
| 37 | + |
| 38 | +<script src="https://repowidget.vercel.app/assets/js/repoWidget.min.js"></script> |
| 39 | +<script> |
| 40 | + createRepoWidget({ |
| 41 | + username: 'your-github-username', |
| 42 | + containerId: 'my-github-repos', |
| 43 | + maxRepos: 6, |
| 44 | + }); |
| 45 | +</script> |
| 46 | +``` |
| 47 | + |
| 48 | +### Option 2: NPM Installation |
| 49 | + |
| 50 | +```bash |
| 51 | +npm install repo-widget |
| 52 | +``` |
| 53 | + |
| 54 | +```javascript |
| 55 | +import { createRepoWidget } from 'repo-widget'; |
| 56 | + |
| 57 | +createRepoWidget({ |
| 58 | + username: 'your-github-username', |
| 59 | + containerId: 'my-github-repos', |
| 60 | + maxRepos: 6, |
| 61 | +}); |
| 62 | +``` |
| 63 | + |
| 64 | +## Configuration Options |
| 65 | + |
| 66 | +RepoWidget is highly customizable. Here's a complete example with all available options: |
| 67 | + |
| 68 | +```javascript |
| 69 | +createRepoWidget({ |
| 70 | + // Required |
| 71 | + username: 'github-username', // GitHub username or organization name |
| 72 | + containerId: 'repos-container', // ID of the container element |
| 73 | + |
| 74 | + // Optional |
| 75 | + maxRepos: 6, // Maximum number of repositories to display |
| 76 | + exclude: ['excluded-repo-1', 'excluded-repo-2'], // Repositories to exclude |
| 77 | + sortBy: 'stars', // Sort repos by: "stars", "forks", or "updated" |
| 78 | + forked: false, // Whether to include forked repositories |
| 79 | + noStyles: false, // Set to true to disable default styles |
| 80 | + |
| 81 | + // Responsive column layout |
| 82 | + columns: { |
| 83 | + mobile: 1, // Columns on mobile (<768px) |
| 84 | + tablet: 2, // Columns on tablet (768px-1023px) |
| 85 | + desktop: 3, // Columns on desktop (>1024px) |
| 86 | + }, |
| 87 | + |
| 88 | + // Custom styles |
| 89 | + cardStyles: { |
| 90 | + backgroundColor: '#ffffff', |
| 91 | + borderRadius: '8px', |
| 92 | + boxShadow: '0 2px 6px rgba(0, 0, 0, 0.1)', |
| 93 | + border: '1px solid #e1e4e8', |
| 94 | + margin: '10px', |
| 95 | + padding: '20px', |
| 96 | + height: '100%', |
| 97 | + }, |
| 98 | + |
| 99 | + textStyles: { |
| 100 | + titleSize: '18px', |
| 101 | + titleColor: '#0366d6', |
| 102 | + titleWeight: '600', |
| 103 | + descriptionColor: '#586069', |
| 104 | + descriptionSize: '14px', |
| 105 | + iconColor: '#586069', |
| 106 | + }, |
| 107 | + |
| 108 | + // Animation |
| 109 | + scaleOnHover: 1.03, // Scale factor on hover (set to null to disable) |
| 110 | + |
| 111 | + // Callbacks |
| 112 | + onLoad: function (repos) { |
| 113 | + console.log('Repositories loaded:', repos); |
| 114 | + }, |
| 115 | + onError: function (error) { |
| 116 | + console.error('Error loading repositories:', error); |
| 117 | + }, |
| 118 | +}); |
| 119 | +``` |
| 120 | + |
| 121 | +## API Reference |
| 122 | + |
| 123 | +For complete API documentation, visit our [API Reference](https://repowidget.vercel.app/api.html). |
| 124 | + |
| 125 | +## Using with GitHub API Token (for higher rate limits) |
| 126 | + |
| 127 | +If you need to display many repositories or need higher rate limits, you can use a GitHub API token: |
| 128 | + |
| 129 | +```javascript |
| 130 | +createRepoWidget({ |
| 131 | + username: 'your-github-username', |
| 132 | + containerId: 'repos-container', |
| 133 | + githubApiToken: 'your-github-token', // Consider using environment variables |
| 134 | +}); |
| 135 | +``` |
| 136 | + |
| 137 | +Note: Only use GitHub tokens in secure contexts and be careful not to expose them in client-side code. Consider using a proxy server for production applications. |
| 138 | + |
| 139 | +## Browser Support |
| 140 | + |
| 141 | +RepoWidget works in all modern browsers: |
| 142 | + |
| 143 | +- Chrome (latest) |
| 144 | +- Firefox (latest) |
| 145 | +- Safari (latest) |
| 146 | +- Edge (latest) |
| 147 | + |
| 148 | +## Contributing |
| 149 | + |
| 150 | +Contributions are welcome! Feel free to open issues or submit pull requests. |
| 151 | + |
| 152 | +1. Fork the repository |
| 153 | +2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
| 154 | +3. Commit your changes (`git commit -m 'Add some amazing feature'`) |
| 155 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 156 | +5. Open a Pull Request |
| 157 | + |
| 158 | +## Development |
| 159 | + |
| 160 | +```bash |
| 161 | +# Install dependencies |
| 162 | +npm install |
| 163 | + |
| 164 | +# Start development server |
| 165 | +npm run dev |
| 166 | + |
| 167 | +# Build for production |
| 168 | +npm run build |
| 169 | +``` |
| 170 | + |
| 171 | +## License |
| 172 | + |
| 173 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 174 | + |
| 175 | +## Contact |
| 176 | + |
| 177 | +Peter Benoit - [GitHub Profile](https://github.com/peterbenoit) |
| 178 | + |
| 179 | +Project Link: [https://github.com/peterbenoit/RepoWidget](https://github.com/peterbenoit/RepoWidget) |
0 commit comments