Skip to content
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

[v4] sync with nextra 3.0.3 #3346

Merged
merged 6 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/small-pumas-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'nextra-theme-blog': patch
'nextra-theme-docs': patch
'nextra': patch
---

sync with nextra 3.0.3
32 changes: 16 additions & 16 deletions docs/app/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@ export default {
type: 'page',
title: 'Documentation'
},
versions: {
type: 'menu',
title: 'Versions',
items: {
'3': {
title: 'Nextra v3 Docs ↗',
href: 'https://nextra-v2-pyibc76cq-shud.vercel.app',
newWindow: true
},
'2': {
title: 'Nextra v2 Docs ↗',
href: 'https://nextra-v2-oe0zrpzjp-shud.vercel.app',
newWindow: true
}
}
},
about: {
type: 'page',
theme: {
Expand All @@ -45,4 +29,20 @@ export default {
timestamp: false
}
},
versions: {
type: 'menu',
title: 'Versions',
items: {
_3: {
title: 'Nextra v3 Docs ↗',
href: 'https://nextra-v2-pyibc76cq-shud.vercel.app',
newWindow: true
},
_2: {
title: 'Nextra v2 Docs ↗',
href: 'https://nextra-v2-oe0zrpzjp-shud.vercel.app',
newWindow: true
}
}
}
}
38 changes: 0 additions & 38 deletions docs/app/sponsors.mdx

This file was deleted.

37 changes: 37 additions & 0 deletions docs/app/sponsors/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Button, Cards } from 'nextra/components'
import { Card } from '../showcase/page.mdx'

<div className="mb-16 mt-10 text-center">
# Sponsors

<p className='mt-4 mb-6 text-lg text-gray-500 dark:text-gray-400'>
{'Your sponsorship means a lot to open source projects, including Nextra'}
</p>
<Button
className="!px-6 hover:!no-underline"
variant="outline"
href="https://github.com/sponsors/dimaMachina"
as="a"
target="_blank"
rel="noreferrer"
>
{'Become a Sponsor'}
</Button>
</div>

{/* <h2 className="text-center">Organization Sponsors</h2> */}

<Cards num={2} className="hover:[&_a]:!no-underline">
<Card
title="Speakeasy"
href="https://speakeasyapi.dev/docs?utm_source=nextra.site&utm_campaign=nextra&utm_content=logolink"
>
<>![Speakeasy preview](../showcase/_logos/speakeasy.png)</>
</Card>
<Card
title="xyflow"
href="https://xyflow.com?utm_source=nextra.site&utm_campaign=nextra&utm_content=logolink"
>
<>![xyflow preview](../showcase/_logos/xyflow.jpg)</>
</Card>
</Cards>
6 changes: 5 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@
"autoprefixer": "^10.4.16",
"postcss": "^8.4.33",
"tailwindcss": "^3.4.1"
}
},
"browserslist": [
">= .25%",
"not dead"
]
}
7 changes: 1 addition & 6 deletions examples/swr-site/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@ export default async function RootLayout({ children, params: { lang } }) {
}

return (
<html
// need to set true RTL language
lang={lang === 'es' ? 'he' : lang}
dir={getDirection(lang)}
suppressHydrationWarning
>
<html lang={lang} dir={getDirection(lang)} suppressHydrationWarning>
<Head
backgroundColor={{
dark: 'rgb(15,23,42)',
Expand Down
6 changes: 5 additions & 1 deletion examples/swr-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
"postcss": "^8.4.33",
"postcss-import": "^16.0.0",
"tailwindcss": "^3.4.1"
}
},
"browserslist": [
">= .25%",
"not dead"
]
}
3 changes: 2 additions & 1 deletion packages/nextra-theme-docs/src/mdx-components/heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const createHeading = (
h4: '_mt-8 _text-xl',
h5: '_mt-8 _text-lg',
h6: '_mt-8 _text-base'
}[Tag]
}[Tag],
className
)

return (
Expand Down
10 changes: 3 additions & 7 deletions packages/nextra/src/client/components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
'use client'

import { Button as HeadlessButton } from '@headlessui/react'
import type { ButtonProps as HeadlessButtonProps } from '@headlessui/react'
import cn from 'clsx'
import type { ReactElement } from 'react'

export const classes = {
border: cn(
'_border _border-gray-300 dark:_border-neutral-700',
'contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50'
)
}
import { classes } from '../mdx-components/pre/index.js'

export type ButtonProps = HeadlessButtonProps & {
variant?: 'outline' | 'default'
Expand Down
1 change: 0 additions & 1 deletion packages/nextra/src/client/components/remote-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ type Scope = Record<string, unknown>
const runtime =
process.env.NODE_ENV === 'production' ? jsxRuntime : jsxDevRuntime


export function evaluate(compiledSource: string, scope: Scope = {}) {
// if we're ready to render, we can assemble the component tree and let React do its thing
// first we set up the scope which has to include the mdx custom
Expand Down
7 changes: 5 additions & 2 deletions packages/nextra/src/client/components/with-icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CPPIcon,
CsharpIcon,
CssIcon,
GoIcon,
GraphQLIcon,
JavaScriptIcon,
MarkdownIcon,
Expand Down Expand Up @@ -38,7 +39,9 @@ const LanguageToIcon: Record<string, FC<SVGProps<SVGElement>>> = {
rs: RustIcon,
terraform: TerraformIcon,
tf: TerraformIcon,
move: MoveIcon
move: MoveIcon,
go: GoIcon,
golang: GoIcon
}

export const withIcons =
Expand All @@ -50,7 +53,7 @@ export const withIcons =

return (
<Component
icon={Icon && <Icon height="16" className="_shrink-0" />}
icon={Icon && <Icon height="16" className="_max-w-6 _shrink-0" />}
{...props}
/>
)
Expand Down
8 changes: 7 additions & 1 deletion packages/nextra/src/client/mdx-components/pre/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import cn from 'clsx'
import type { ComponentProps, ReactElement, ReactNode } from 'react'
import { classes } from '../../components/button.js'
import { WordWrapIcon } from '../../icons/index.js'
import { CopyToClipboard } from './copy-to-clipboard.js'
import { ToggleWordWrapButton } from './toggle-word-wrap-button.js'

export const classes = {
border: cn(
'_border _border-gray-300 dark:_border-neutral-700',
'contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50'
)
}

export type PreProps = ComponentProps<'pre'> & {
'data-filename'?: string
'data-copy'?: ''
Expand Down
6 changes: 6 additions & 0 deletions packages/nextra/src/server/generate-page-map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('generatePageMapFromFilepaths()', () => {
"docs/page.mdx",
"page.tsx",
"showcase/page.mdx",
"sponsors/page.mdx",
]
`)

Expand Down Expand Up @@ -460,6 +461,11 @@ describe('generatePageMapFromFilepaths()', () => {
"name": "showcase",
"route": "/showcase",
},
{
"__pagePath": "sponsors/page.mdx",
"name": "sponsors",
"route": "/sponsors",
},
]
`)
})
Expand Down