Skip to content

GitHubCallout #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

GitHubCallout #16

wants to merge 1 commit into from

Conversation

erunion
Copy link
Member

@erunion erunion commented Apr 1, 2025

<GitHubCallout>

I've always been very fond of the way that GitHub renders callouts:

Tip

Like this!

This replicates that with a new component.

Usage

Please add a usage example, as well as any other pertinent details, here.

<GitHubCallout type="tip">
  Like this!
</GitHubCallout>

@erunion erunion marked this pull request as ready for review April 1, 2025 23:17
}

return (
<div className={`pl-3 border-l-1 border-${color}-500 dark:border-${color}-400`}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may or may not work, just make sure it does! (I can see it working in the preview but not working when used)

The reason is that Tailwind compiles down the strings for performance reasons, so it doesn't understand interpolation like this.

If it doesn't work, the way to fix it is to do this:

color  = 'border-green-500';
...
<div className={`pl-3 border-l-1 ${color}`}>

(Tailwind just uses a regex to find everything that fits, so as long as it's written SOMEWHERE in the code it'll catch it. But it can't deal with variables like this.)

(If it works in the preview, it should work everywhere! If not that's a bigger issue we should address.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(If you get stuck here, just ping me and I can help out! Both for this PR and ReadMe in general)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My eyes may be deceiving because of the minor difference I put in for the light vs dark colors but it seems to be working as-is?

Screenshot 2025-04-01 at 4 35 45 PM
Screenshot 2025-04-01 at 4 35 49 PM

@erunion
Copy link
Member Author

erunion commented Apr 2, 2025

@kellyjosephprice is doing a small tweak to the Markdown library in readmeio/markdown#1075 to allow for this to override our core Callout component. will refactor this with those prop changes when that lands. moving to draft for now!

@erunion erunion marked this pull request as draft April 2, 2025 00: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.

2 participants