Skip to content

Commit

Permalink
add logo for golang (#3337) (#3338)
Browse files Browse the repository at this point in the history
* add logo for golang (#3337)

* fix icon

* polish

* Update .changeset/rare-ravens-guess.md

---------

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
  • Loading branch information
grampelberg and dimaMachina authored Oct 2, 2024
1 parent 82fc267 commit 5fbce2f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/rare-ravens-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'nextra': minor
'nextra-theme-docs': minor
'nextra-theme-blog': minor
---

Added golang logo for code blocks.
2 changes: 1 addition & 1 deletion packages/nextra/src/client/components/pre.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function Pre({
'_border-b-0'
)}
>
{Icon && <Icon className="_h-4 _w-auto _shrink-0" />}
{Icon && <Icon className="_h-4 _w-auto _max-w-6 _shrink-0" />}
<span className="_truncate">{filename}</span>
{copyButton}
</div>
Expand Down
21 changes: 21 additions & 0 deletions packages/nextra/src/client/icons/go.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/nextra/src/client/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export { ReactComponent as DiscordIcon } from './discord.svg'
export { ReactComponent as ExpandIcon } from './expand.svg'
export { ReactComponent as GitHubIcon } from './github.svg'
export { ReactComponent as GlobeIcon } from './globe.svg'
export { ReactComponent as GoIcon } from './go.svg'
export { ReactComponent as InformationCircleIcon } from './information-circle.svg'
export { ReactComponent as MenuIcon } from './menu.svg'
export { ReactComponent as MoonIcon } from './moon.svg'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ describe('rehypeIcon', () => {
import { RustIcon } from 'nextra/icons'
import { TerraformIcon } from 'nextra/icons'
import { MoveIcon } from 'nextra/icons'
import { GoIcon } from 'nextra/icons'
function _createMdxContent(props) {
const _components = {
code: 'code',
Expand Down Expand Up @@ -231,6 +232,20 @@ describe('rehypeIcon', () => {
<_components.span> </_components.span>
</_components.code>
</_components.pre>
{'\\n'}
<_components.pre icon={GoIcon} tabIndex="0" data-language="go" data-word-wrap="" data-copy="">
<_components.code>
<_components.span> </_components.span>
</_components.code>
</_components.pre>
{'\\n'}
<_components.pre icon={GoIcon} tabIndex="0" data-language="golang" data-word-wrap="" data-copy="">
<_components.code>
<_components.span>
<_components.span />
</_components.span>
</_components.code>
</_components.pre>
</>
)
}
Expand Down
4 changes: 3 additions & 1 deletion packages/nextra/src/server/rehype-plugins/rehype-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const REHYPE_ICON_DEFAULT_REPLACES: Record<string, string> = {
rs: 'RustIcon',
terraform: 'TerraformIcon',
tf: 'TerraformIcon',
move: 'MoveIcon'
move: 'MoveIcon',
go: 'GoIcon',
golang: 'GoIcon'
}

function createImport(iconName: string) {
Expand Down

0 comments on commit 5fbce2f

Please sign in to comment.