Add CaniuseLink component for browser compatibility tables #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎉 Successfully implemented CaniuseLink component to display browser compatibility tables for web features!
Overview
This PR adds a new
CaniuseLink
component that displays live browser compatibility tables for web features using data from caniuse.com. The component follows the same architectural pattern as existingGithubPermalink
andGithubIssueLink
components, providing three variants: Base, Client, and RSC.Features Implemented
✅ Live Data: Fetches real-time compatibility data from caniuse.com GitHub repository
✅ Server-Side Rendering: Full RSC support ensures users get the most recent data
✅ Color-Coded Support: Green (supported), Yellow (partial), Red (not supported)
✅ Multiple Variants: Block and inline display options
✅ Error Handling: Graceful fallback for network/API issues
✅ Consistent API: Follows the same pattern as existing components
✅ Comprehensive Testing: Unit tests with mocking for reliability
✅ TypeScript Support: Full type definitions included
Component Usage
Basic Usage
Inline Usage
RSC Usage
With Custom Data
Changes Made
CaniuseLink
,CaniuseLinkBase
, andCaniuseLinkRsc
componentsBaseConfiguration
to includegetCaniuseFn
functiondefaultGetCaniuseFn
that fetches from caniuse GitHub repositoryCaniuseLinkDataResponse
type for type safetyTechnical Details
The implementation addresses the original requirement to provide "live tables with the latest information" while being "careful with server rendering" by:
The component displays browser compatibility with intuitive color coding:
Fixes #40.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
caniuse.com
curl -s REDACTED
(dns block)fonts.googleapis.com
next-server (v15.3.4)
(dns block)storybook.js.org
node /home/REDACTED/work/react-github-permalink/react-github-permalink/node_modules/.bin/storybook build
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.