Skip to content

Commit 9b5e0db

Browse files
renovate[bot]danez
andauthored
chore(deps): update nextra monorepo to v3 (major) (#945)
* chore(deps): update nextra monorepo to v3 * Upgrade all files for nextra v3 * Update built-in components * Fix lint --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Tschinder <231804+danez@users.noreply.github.com>
1 parent 0771fa6 commit 9b5e0db

File tree

32 files changed

+1643
-1029
lines changed

32 files changed

+1643
-1029
lines changed

packages/website/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

packages/website/next.config.js renamed to packages/website/next.config.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
const withNextra = require('nextra')({
1+
import nextra from 'nextra';
2+
3+
const withNextra = nextra({
24
theme: 'nextra-theme-docs',
35
themeConfig: './src/theme.config.tsx',
46
});
57

6-
module.exports = withNextra({
8+
export default withNextra({
79
webpack: (config) => {
810
if (!config.resolve.fallback) config.resolve.fallback = {};
911

packages/website/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
"@codemirror/lang-javascript": "6.2.2",
1515
"@codemirror/lang-json": "6.0.1",
1616
"@codemirror/view": "6.34.1",
17-
"@headlessui/react": "1.7.19",
18-
"@popperjs/core": "2.11.8",
17+
"@headlessui/react": "2.2.0",
1918
"@types/react": "18.3.11",
2019
"@types/react-dom": "18.3.1",
2120
"@uiw/react-codemirror": "4.23.5",
2221
"clsx": "2.1.1",
2322
"next": "14.2.16",
24-
"next-themes": "0.3.0",
25-
"nextra": "2.13.4",
26-
"nextra-theme-docs": "2.13.4",
23+
"next-themes": "0.4.3",
24+
"nextra": "3.2.3",
25+
"nextra-theme-docs": "3.2.3",
2726
"postcss": "8.4.47",
2827
"postcss-lightningcss": "1.0.1",
2928
"react": "18.3.1",
Lines changed: 55 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import type { ReactElement, ReactNode } from 'react';
1+
import {
2+
Listbox,
3+
ListboxButton,
4+
ListboxOption,
5+
ListboxOptions,
6+
} from '@headlessui/react';
27
import cn from 'clsx';
3-
import { Listbox, Transition } from '@headlessui/react';
48
import { CheckIcon } from 'nextra/icons';
5-
import { usePopper } from '../utils/usePopper';
6-
import { createPortal } from 'react-dom';
7-
import { useMounted } from 'nextra/hooks';
9+
import type { ReactElement } from 'react';
810

911
interface MenuOption {
1012
key: string;
@@ -26,82 +28,59 @@ export function Select({
2628
title,
2729
className,
2830
}: MenuProps): ReactElement {
29-
const [trigger, container] = usePopper({
30-
strategy: 'fixed',
31-
placement: 'top-start',
32-
modifiers: [
33-
{ name: 'offset', options: { offset: [0, 10] } },
34-
{
35-
name: 'sameWidth',
36-
enabled: true,
37-
fn({ state }) {
38-
state.styles.popper.minWidth = `${state.rects.reference.width}px`;
39-
},
40-
phase: 'beforeWrite',
41-
requires: ['computeStyles'],
42-
},
43-
],
44-
});
45-
4631
return (
4732
<Listbox value={selected} onChange={onChange}>
48-
{({ open }) => (
49-
<Listbox.Button
50-
ref={trigger}
51-
title={title}
52-
className={cn(
53-
'h-7 rounded-md px-2 text-left text-xs font-medium text-gray-600 transition-colors dark:text-gray-400',
33+
<ListboxButton
34+
title={title}
35+
className={({ hover, open, focus }) =>
36+
cn(
37+
'h-7 rounded-md px-2 text-xs font-medium transition-colors',
5438
open
5539
? 'dark:bg-primary-100/10 bg-gray-200 text-gray-900 dark:text-gray-50'
56-
: 'dark:hover:bg-primary-100/5 hover:bg-gray-100 hover:text-gray-900 dark:hover:text-gray-50',
40+
: hover
41+
? 'dark:bg-primary-100/5 bg-gray-100 text-gray-900 dark:text-gray-50'
42+
: 'text-gray-600 dark:text-gray-400',
43+
focus && 'nextra-focusable',
5744
className,
58-
)}
59-
>
60-
{selected.name}
61-
<Portal>
62-
<Transition
63-
ref={container}
64-
show={open}
65-
as={Listbox.Options}
66-
className="z-20 max-h-64 overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black/5 dark:bg-neutral-800 dark:ring-white/20"
67-
leave="transition-opacity"
68-
leaveFrom="opacity-100"
69-
leaveTo="opacity-0"
70-
>
71-
{options.map((option) => (
72-
<Listbox.Option
73-
key={option.key}
74-
value={option}
75-
className={({ active }) =>
76-
cn(
77-
active
78-
? 'bg-primary-50 text-primary-600 dark:bg-primary-500/10'
79-
: 'text-gray-800 dark:text-gray-100',
80-
'relative cursor-pointer whitespace-nowrap py-1.5',
81-
'transition-colors ltr:pl-3 ltr:pr-9 rtl:pl-9 rtl:pr-3',
82-
)
83-
}
84-
>
85-
{option.name}
86-
{option.key === selected.key && (
87-
<span className="absolute inset-y-0 flex items-center ltr:right-3 rtl:left-3">
88-
<CheckIcon />
89-
</span>
90-
)}
91-
</Listbox.Option>
92-
))}
93-
</Transition>
94-
</Portal>
95-
</Listbox.Button>
96-
)}
45+
)
46+
}
47+
>
48+
{selected.name}
49+
</ListboxButton>
50+
<ListboxOptions
51+
as="ul"
52+
transition
53+
anchor={{ to: 'top start', gap: 10 }}
54+
className={({ open }) =>
55+
cn(
56+
'nextra-focus',
57+
open ? 'opacity-100' : 'opacity-0',
58+
'z-20 max-h-64 min-w-[--button-width] rounded-md border border-black/5 bg-[rgb(var(--nextra-bg),.8)] py-1 text-sm shadow-lg backdrop-blur-lg transition-opacity motion-reduce:transition-none dark:border-white/20',
59+
)
60+
}
61+
>
62+
{options.map((option) => (
63+
<ListboxOption
64+
key={option.key}
65+
value={option}
66+
as="li"
67+
className={({ focus }) =>
68+
cn(
69+
focus
70+
? 'bg-primary-50 text-primary-600 dark:bg-primary-500/10'
71+
: 'text-gray-800 dark:text-gray-100',
72+
'cursor-pointer whitespace-nowrap px-3 py-1.5',
73+
'transition-colors',
74+
option.key === selected.key &&
75+
'flex items-center justify-between gap-3',
76+
)
77+
}
78+
>
79+
{option.name}
80+
{option.key === selected.key && <CheckIcon height="16" />}
81+
</ListboxOption>
82+
))}
83+
</ListboxOptions>
9784
</Listbox>
9885
);
9986
}
100-
101-
function Portal(props: { children: ReactNode }): ReactElement | null {
102-
const mounted = useMounted();
103-
104-
if (!mounted) return null;
105-
106-
return createPortal(props.children, document.body);
107-
}

packages/website/src/pages/_app.mdx

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import './globals.css';
2+
import type { AppProps } from 'next/app';
3+
4+
export default function App({ Component, pageProps }: AppProps) {
5+
return <Component {...pageProps} />;
6+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export default {
2+
index: {
3+
title: 'Home',
4+
type: 'page',
5+
},
6+
docs: {
7+
title: 'Docs',
8+
type: 'page',
9+
},
10+
playground: {
11+
title: 'Playground',
12+
type: 'page',
13+
theme: {
14+
layout: 'raw',
15+
},
16+
},
17+
users: {
18+
title: 'Users',
19+
type: 'page',
20+
theme: {
21+
typesetting: 'article',
22+
},
23+
},
24+
about: {
25+
title: 'About',
26+
type: 'page',
27+
theme: {
28+
typesetting: 'article',
29+
},
30+
},
31+
};

packages/website/src/pages/_meta.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

packages/website/src/pages/about.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
title: 'About'
3+
---
14
# About react-docgen
25

36
react-docgen was initially created by [Facebook](https://www.facebook.com) member
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
'getting-started': 'Getting started',
3+
extending: 'Extending',
4+
reference: 'Reference',
5+
migrate: 'Migrate',
6+
'release-notes': 'Release Notes',
7+
};

0 commit comments

Comments
 (0)