Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 16, 2025

The current GithubPermalink component displays full GitHub-style headers with path, line numbers, and commit info. This adds a collapsible variant that defaults to showing just the code block with minimal chrome: a chevron to expand/collapse and a subtle GitHub icon link.

Changes

Configuration

  • Added initiallyExpandGithubPermalinks?: boolean to BaseConfiguration (default: true)
  • Propagated through both context provider and RSC config

Component

  • Added isInitiallyExpanded?: boolean prop to GithubPermalinkBase
  • Implements expand/collapse state with chevron icons (ChevronDownSvg, ChevronRightSvg)
  • Collapsed state: removes header background/border, shows only GitHub icon link and code
  • Expanded state: shows full header with file path, line numbers, commit link, and copy button

Styling

  • .collapsed class removes border/background from header
  • GitHub icon link at 60% opacity with hover to 100%

Usage

// Component-level control
<GithubPermalink 
  permalink="https://github.com/..." 
  isInitiallyExpanded={false} 
/>

// Global config via provider
<GithubPermalinkProvider initiallyExpandGithubPermalinks={false}>
  <GithubPermalink permalink="..." />
</GithubPermalinkProvider>

// RSC config
githubPermalinkRscConfig.setConfig({
  initiallyExpandGithubPermalinks: false
});

Screenshots

Expanded (default)
image

Collapsed (minimal)
image

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • storybook.js.org
    • Triggering command: node /home/REDACTED/work/react-github-permalink/react-github-permalink/node_modules/.bin/storybook build (dns block)
    • Triggering command: node /home/REDACTED/work/react-github-permalink/react-github-permalink/node_modules/.bin/storybook dev -p 6006 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Create a 'minimal' variant of GithubPermalink.</issue_title>
<issue_description>The current Github Permalink block is very much based on what we see in Github.

This contains too much superflous content - usually what we want is just a codeblock. It should still be able to link back to Github though.

I think the best thing is going to be subtle Github Octocat icon that serves as the link, and a chevron to expand the full details.

The existing Github Permalnk can be extended - and should have a 'isInitiallyExpanded' property.

The global configuration should have 'initiallyExpandGithubPermalinks' to determine the default behaviour of isInitiallyExpanded. This default should be true. </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 16, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 16, 2025

⚠️ No Changeset found

Latest commit: 895c214

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Nov 16, 2025

Deploy Preview for react-github-permalink ready!

Name Link
🔨 Latest commit 895c214
🔍 Latest deploy log https://app.netlify.com/projects/react-github-permalink/deploys/691a56871622360008938386
😎 Deploy Preview https://deploy-preview-87--react-github-permalink.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Create minimal variant of GithubPermalink Add collapsible minimal variant for GithubPermalink Nov 16, 2025
Copilot AI requested a review from dwjohnston November 16, 2025 23:04
Copilot finished work on behalf of dwjohnston November 16, 2025 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a 'minimal' variant of GithubPermalink.

2 participants