Skip to content

Commit 16464b7

Browse files
committed
Merge branch 'main' into pr/glovooker/594
2 parents 332bef0 + 2a180a0 commit 16464b7

File tree

258 files changed

+28466
-8780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+28466
-8780
lines changed

README.md

+1-1

TRANSLATION.md

+13-9

beta/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"check-all": "npm-run-all prettier lint:fix tsc"
2323
},
2424
"dependencies": {
25-
"@codesandbox/sandpack-react": "1.14.1",
25+
"@codesandbox/sandpack-react": "1.15.5",
2626
"@docsearch/css": "3.0.0-alpha.41",
2727
"@docsearch/react": "3.0.0-alpha.41",
2828
"@headlessui/react": "^1.7.0",
@@ -67,7 +67,7 @@
6767
"eslint-plugin-import": "2.x",
6868
"eslint-plugin-jsx-a11y": "6.x",
6969
"eslint-plugin-react": "7.x",
70-
"eslint-plugin-react-hooks": "experimental",
70+
"eslint-plugin-react-hooks": "^0.0.0-experimental-fabef7a6b-20221215",
7171
"fs-extra": "^9.0.1",
7272
"globby": "^11.0.1",
7373
"gray-matter": "^4.0.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/node_modules/@codemirror/lang-javascript/dist/index.cjs b/node_modules/@codemirror/lang-javascript/dist/index.cjs
2+
index 4475e4f..e1255c9 100644
3+
--- a/node_modules/@codemirror/lang-javascript/dist/index.cjs
4+
+++ b/node_modules/@codemirror/lang-javascript/dist/index.cjs
5+
@@ -135,7 +135,9 @@ const javascriptLanguage = language.LRLanguage.define({
6+
JSXText: highlight.tags.content,
7+
"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": highlight.tags.angleBracket,
8+
"JSXIdentifier JSXNameSpacedName": highlight.tags.tagName,
9+
- "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": highlight.tags.attributeName
10+
+ "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": highlight.tags.attributeName,
11+
+ "JSXAttribute/JSXLowerIdentifier JSXAttribute/JSXNameSpacedName": highlight.tags.attributeName,
12+
+ "JSXBuiltin/JSXIdentifier": highlight.tags.standard(highlight.tags.tagName)
13+
})
14+
]
15+
}),
16+
diff --git a/node_modules/@codemirror/lang-javascript/dist/index.js b/node_modules/@codemirror/lang-javascript/dist/index.js
17+
index d089f6b..db09ea6 100644
18+
--- a/node_modules/@codemirror/lang-javascript/dist/index.js
19+
+++ b/node_modules/@codemirror/lang-javascript/dist/index.js
20+
@@ -131,7 +131,9 @@ const javascriptLanguage = /*@__PURE__*/LRLanguage.define({
21+
JSXText: tags.content,
22+
"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": tags.angleBracket,
23+
"JSXIdentifier JSXNameSpacedName": tags.tagName,
24+
- "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName
25+
+ "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName,
26+
+ "JSXAttribute/JSXLowerIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName,
27+
+ "JSXBuiltin/JSXIdentifier": tags.standard(tags.tagName),
28+
})
29+
]
30+
}),

beta/patches/@codesandbox+sandpack-react+1.15.5.patch

+26
Large diffs are not rendered by default.

beta/patches/@lezer+javascript+0.15.2.patch

+345
Large diffs are not rendered by default.

beta/public/images/team/acdlite.jpg

-348 KB

beta/public/images/team/bvaughn.jpg

-388 KB
Binary file not shown.

beta/public/images/team/gaearon.jpg

-350 KB

beta/public/images/team/huxpro.jpg

-340 KB
Binary file not shown.
232 KB

beta/public/images/team/joe.jpg

90.2 KB

beta/public/images/team/josh.jpg

121 KB

beta/public/images/team/lauren.jpg

147 KB

beta/public/images/team/lunaruan.jpg

-256 KB
2.26 MB

beta/public/images/team/necolas.jpg

-378 KB
Binary file not shown.
-162 KB

beta/public/images/team/rnabors.jpg

-302 KB
Binary file not shown.

beta/public/images/team/salazarm.jpeg

-75.2 KB
Binary file not shown.

beta/public/images/team/sam.jpg

99.9 KB

beta/public/images/team/sathya.jpg

69.2 KB
-137 KB
160 KB
167 KB
-503 KB
Binary file not shown.

beta/public/images/team/tianyu.jpg

51.4 KB

beta/public/images/team/trueadm.jpg

-64.1 KB
Binary file not shown.
-23.4 KB
Binary file not shown.
3.96 KB
18.7 KB
-10.9 KB
Binary file not shown.
-16.4 KB
Binary file not shown.
2.53 KB

beta/src/components/Breadcrumbs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Breadcrumbs() {
1010
const {breadcrumbs} = useRouteMeta();
1111
if (!breadcrumbs) return null;
1212
return (
13-
<div className="flex">
13+
<div className="flex flex-wrap">
1414
{breadcrumbs.map(
1515
(crumb, i) =>
1616
crumb.path && (

beta/src/components/Icon/IconGitHub.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ export const IconGitHub = memo<JSX.IntrinsicElements['svg']>(
88
function IconGitHub(props) {
99
return (
1010
<svg
11-
width="1em"
11+
xmlns="http://www.w3.org/2000/svg"
12+
width="1.33em"
13+
height="1.33em"
14+
viewBox="0 -2 24 24"
1215
fill="currentColor"
13-
height="1em"
14-
viewBox="0 0 20 20"
1516
{...props}>
1617
<path d="M10 0a10 10 0 0 0-3.16 19.49c.5.1.68-.22.68-.48l-.01-1.7c-2.78.6-3.37-1.34-3.37-1.34-.46-1.16-1.11-1.47-1.11-1.47-.9-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.52 2.34 1.08 2.91.83.1-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.1.39-1.99 1.03-2.69a3.6 3.6 0 0 1 .1-2.64s.84-.27 2.75 1.02a9.58 9.58 0 0 1 5 0c1.91-1.3 2.75-1.02 2.75-1.02.55 1.37.2 2.4.1 2.64.64.7 1.03 1.6 1.03 2.69 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85l-.01 2.75c0 .26.18.58.69.48A10 10 0 0 0 10 0"></path>
1718
</svg>

beta/src/components/Icon/IconLink.tsx

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*/
4+
5+
import {memo} from 'react';
6+
7+
export const IconLink = memo<JSX.IntrinsicElements['svg']>(function IconLink(
8+
props
9+
) {
10+
return (
11+
<svg
12+
xmlns="http://www.w3.org/2000/svg"
13+
width="1.33em"
14+
height="1.33em"
15+
viewBox="0 -2 24 24"
16+
fill="currentColor"
17+
{...props}>
18+
<path
19+
strokeLinecap="round"
20+
strokeLinejoin="round"
21+
d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"
22+
/>
23+
</svg>
24+
);
25+
});

beta/src/components/Layout/Footer.tsx

+16-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ButtonLink from 'components/ButtonLink';
99
import {ExternalLink} from 'components/ExternalLink';
1010
import {IconFacebookCircle} from 'components/Icon/IconFacebookCircle';
1111
import {IconTwitter} from 'components/Icon/IconTwitter';
12+
import {IconGitHub} from 'components/Icon/IconGitHub';
1213
import {IconNavArrow} from 'components/Icon/IconNavArrow';
1314

1415
export function Footer() {
@@ -111,11 +112,13 @@ export function Footer() {
111112
</FooterLink>
112113
</div>
113114
<div className="flex flex-col">
114-
<FooterLink href="/apis/react" isHeader={true}>
115+
<FooterLink href="/reference/react" isHeader={true}>
115116
API Reference
116117
</FooterLink>
117-
<FooterLink href="/apis/react">React APIs</FooterLink>
118-
<FooterLink href="/apis/react-dom">React DOM APIs</FooterLink>
118+
<FooterLink href="/reference/react">React APIs</FooterLink>
119+
<FooterLink href="/reference/react-dom">
120+
React DOM APIs
121+
</FooterLink>
119122
</div>
120123
<div className="flex flex-col sm:col-start-2 xl:col-start-4">
121124
<FooterLink href="/" isHeader={true}>
@@ -124,12 +127,13 @@ export function Footer() {
124127
<FooterLink href="https://github.com/facebook/react/blob/main/CODE_OF_CONDUCT.md">
125128
Code of Conduct
126129
</FooterLink>
127-
<FooterLink href="/community/acknowledgements">
130+
<FooterLink href="/learn/acknowledgements">
128131
Acknowledgements
129132
</FooterLink>
130-
<FooterLink href="/community/meet-the-team">
131-
Meet the Team
133+
<FooterLink href="/learn/docs-contributors">
134+
Docs Contributors
132135
</FooterLink>
136+
<FooterLink href="/learn/meet-the-team">Meet the Team</FooterLink>
133137
<FooterLink href="https://reactjs.org/blog">Blog</FooterLink>
134138
{/* <FooterLink href="/">Community Resources</FooterLink> */}
135139
</div>
@@ -160,6 +164,12 @@ export function Footer() {
160164
className={socialLinkClasses}>
161165
<IconTwitter />
162166
</ExternalLink>
167+
<ExternalLink
168+
aria-label="React on Github"
169+
href="https://github.com/facebook/react"
170+
className={socialLinkClasses}>
171+
<IconGitHub />
172+
</ExternalLink>
163173
</div>
164174
</div>
165175
</div>

beta/src/components/Layout/MarkdownPage.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
*/
44

55
import * as React from 'react';
6+
import {useRouter} from 'next/router';
67
import {DocsPageFooter} from 'components/DocsFooter';
78
import {Seo} from 'components/Seo';
89
import PageHeading from 'components/PageHeading';
910
import {useRouteMeta} from './useRouteMeta';
11+
import {useActiveSection} from '../../hooks/useActiveSection';
1012
import {TocContext} from '../MDX/TocContext';
1113

1214
import(/* webpackPrefetch: true */ '../MDX/CodeBlock/CodeBlock');
@@ -25,13 +27,10 @@ export function MarkdownPage<
2527
T extends {title: string; status?: string} = {title: string; status?: string}
2628
>({children, meta, toc}: MarkdownProps<T>) {
2729
const {route, nextRoute, prevRoute} = useRouteMeta();
30+
const section = useActiveSection();
2831
const title = meta.title || route?.title || '';
2932
const description = meta.description || route?.description || '';
30-
31-
if (!route) {
32-
console.error('This page was not added to one of the sidebar JSON files.');
33-
}
34-
const isHomePage = route?.path === '/';
33+
const isHomePage = section === 'home';
3534
return (
3635
<>
3736
<div className="pl-0">

beta/src/components/Layout/Nav/Nav.tsx

+17-26
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import NavLink from './NavLink';
1919
import {SidebarContext} from 'components/Layout/useRouteMeta';
2020
import {SidebarRouteTree} from '../Sidebar/SidebarRouteTree';
2121
import type {RouteItem} from '../useRouteMeta';
22-
import sidebarHome from '../../../sidebarHome.json';
2322
import sidebarLearn from '../../../sidebarLearn.json';
2423
import sidebarReference from '../../../sidebarReference.json';
2524

@@ -115,12 +114,10 @@ export default function Nav() {
115114
if (isOpen) {
116115
switch (tab) {
117116
case 'home':
118-
routeTree = sidebarHome as RouteItem;
119-
break;
120117
case 'learn':
121118
routeTree = sidebarLearn as RouteItem;
122119
break;
123-
case 'apis':
120+
case 'reference':
124121
routeTree = sidebarReference as RouteItem;
125122
break;
126123
}
@@ -188,7 +185,7 @@ export default function Nav() {
188185
});
189186
}, [showFeedback]);
190187

191-
function selectTab(nextTab: 'learn' | 'apis' | 'home') {
188+
function selectTab(nextTab: 'learn' | 'reference') {
192189
setTab(nextTab);
193190
scrollParentRef.current!.scrollTop = 0;
194191
}
@@ -217,7 +214,7 @@ export default function Nav() {
217214
</a>
218215
</NextLink>
219216
<div className="lg:w-full leading-loose hidden sm:flex flex-initial items-center h-auto pr-5 lg:pr-5 pt-0.5">
220-
<div className="px-1 mb-px bg-highlight dark:bg-highlight-dark rounded text-link dark:text-link-dark uppercase font-bold tracking-wide text-xs whitespace-nowrap">
217+
<div className="px-1 mb-px bg-highlight dark:bg-highlight-dark rounded uppercase text-link dark:text-link-dark font-bold tracking-wide text-xs whitespace-nowrap">
221218
Beta
222219
</div>
223220
</div>
@@ -244,15 +241,19 @@ export default function Nav() {
244241
</button>
245242
</div>
246243
</div>
244+
{!isOpen && (
245+
<div className="hidden lg:block sm:pt-10 lg:pt-4">
246+
<Search />
247+
</div>
248+
)}
247249
<div className="px-0 pt-2 w-full 2xl:max-w-xs hidden lg:flex items-center self-center border-b-0 lg:border-b border-border dark:border-border-dark">
248-
<NavLink href="/" isActive={section === 'home'}>
249-
Inicio
250-
</NavLink>
251-
<NavLink href="/learn" isActive={section === 'learn'}>
250+
<NavLink
251+
href="/learn"
252+
isActive={section === 'learn' || section === 'home'}>
252253
Aprende
253254
</NavLink>
254-
<NavLink href="/apis/react" isActive={section === 'apis'}>
255-
API
255+
<NavLink href="/reference/react" isActive={section === 'reference'}>
256+
Referencia
256257
</NavLink>
257258
</div>
258259
<div className="flex my-4 h-10 mx-0 w-full lg:hidden justify-end lg:max-w-sm">
@@ -312,19 +313,14 @@ export default function Nav() {
312313
{isOpen && (
313314
<div className="bg-wash dark:bg-wash-dark px-5 flex justify-end border-b border-border dark:border-border-dark items-center self-center w-full z-10">
314315
<TabButton
315-
isActive={tab === 'home'}
316-
onClick={() => selectTab('home')}>
317-
Inicio
318-
</TabButton>
319-
<TabButton
320-
isActive={tab === 'learn'}
316+
isActive={tab === 'learn' || tab === 'home'}
321317
onClick={() => selectTab('learn')}>
322318
Aprende
323319
</TabButton>
324320
<TabButton
325-
isActive={tab === 'apis'}
326-
onClick={() => selectTab('apis')}>
327-
API
321+
isActive={tab === 'reference'}
322+
onClick={() => selectTab('reference')}>
323+
Referencia
328324
</TabButton>
329325
</div>
330326
)}
@@ -337,11 +333,6 @@ export default function Nav() {
337333
`lg:grow lg:flex flex-col w-full pb-8 lg:pb-0 lg:max-w-xs z-10`,
338334
isOpen ? 'block z-40' : 'hidden lg:block'
339335
)}>
340-
{!isOpen && (
341-
<div className="px-5 sm:pt-10 lg:pt-4">
342-
<Search />
343-
</div>
344-
)}
345336
<nav
346337
role="navigation"
347338
style={{'--bg-opacity': '.2'} as React.CSSProperties} // Need to cast here because CSS vars aren't considered valid in TS types (cuz they could be anything)

beta/src/components/Layout/Page.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {useActiveSection} from 'hooks/useActiveSection';
1111
import {Footer} from './Footer';
1212
import {Toc} from './Toc';
1313
import SocialBanner from '../SocialBanner';
14-
import sidebarHome from '../../sidebarHome.json';
1514
import sidebarLearn from '../../sidebarLearn.json';
1615
import sidebarReference from '../../sidebarReference.json';
1716
import type {TocItem} from 'components/MDX/TocContext';
@@ -24,14 +23,11 @@ interface PageProps {
2423
export function Page({children, toc}: PageProps) {
2524
const {asPath} = useRouter();
2625
const section = useActiveSection();
27-
let routeTree = sidebarHome as RouteItem;
26+
let routeTree = sidebarLearn as RouteItem;
2827
switch (section) {
29-
case 'apis':
28+
case 'reference':
3029
routeTree = sidebarReference as RouteItem;
3130
break;
32-
case 'learn':
33-
routeTree = sidebarLearn as RouteItem;
34-
break;
3531
}
3632
return (
3733
<>

0 commit comments

Comments
 (0)