Skip to content

Commit

Permalink
[v3] Add Terraform icon (#2811)
Browse files Browse the repository at this point in the history
* [v3] Add terraform codeblock icon

* [v3] Fix lint nextra-theme-docs
  • Loading branch information
hariria committed Apr 5, 2024
1 parent ad108ff commit 85de23b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 0 additions & 1 deletion examples/swr-site/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
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 @@ -23,3 +23,4 @@ export { ReactComponent as CsharpIcon } from './csharp.svg'
export { ReactComponent as GraphQLIcon } from './graphql.svg'
export { ReactComponent as PythonIcon } from './python.svg'
export { ReactComponent as RustIcon } from './rust.svg'
export { ReactComponent as TerraformIcon } from './terraform.svg'
3 changes: 3 additions & 0 deletions packages/nextra/src/client/icons/terraform.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe('rehypeIcon', () => {
import { GraphQLIcon } from 'nextra/icons'
import { PythonIcon } from 'nextra/icons'
import { RustIcon } from 'nextra/icons'
import { TerraformIcon } from 'nextra/icons'
function _createMdxContent(props) {
const _components = {
code: 'code',
Expand Down Expand Up @@ -211,6 +212,22 @@ describe('rehypeIcon', () => {
<_components.span> </_components.span>
</_components.code>
</_components.pre>
{'\\n'}
<_components.pre icon={TerraformIcon} tabIndex="0" data-language="terraform" data-word-wrap="" data-copy="">
<_components.code>
<_components.span>
<_components.span />
</_components.span>
</_components.code>
</_components.pre>
{'\\n'}
<_components.pre icon={TerraformIcon} tabIndex="0" data-language="tf" 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 @@ -22,7 +22,9 @@ export const REHYPE_ICON_DEFAULT_REPLACES: Record<string, string> = {
python: 'PythonIcon',
py: 'PythonIcon',
rust: 'RustIcon',
rs: 'RustIcon'
rs: 'RustIcon',
terraform: 'TerraformIcon',
tf: 'TerraformIcon'
}

function createImport(iconName: string) {
Expand Down

0 comments on commit 85de23b

Please sign in to comment.