Skip to content

Commit 2890036

Browse files
Add stub pages for all React and ReactDOM APIs (reactjs#4910)
* Add ReactDOM Client APIs * Feedback fixes * TODO and link fixes * Update createRoot.md * Nits * Nits * Update reactdomclient.md * Update hydrateRoot.md * Update hydrateRoot.md * Update createRoot.md * Update hydrateRoot.md * createRoot tweaks * bla * tweaks * tweaks * tweak * bump * Add another troubleshooting error * Add stubs for React.* APIs * Add and organize remaining APIs * Update links * fix whitespace * Add re-directs for old API URLs * Fix some links * Add StrictMode Co-authored-by: dan <dan.abramov@gmail.com>
1 parent c527d4e commit 2890036

Some content is hidden

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

73 files changed

+1714
-272
lines changed

beta/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The documentation is divided into sections to cater to different learning styles
2020

2121
**[Learn React](https://beta.reactjs.org/learn)** is designed to introduce fundamental concepts in a step-by-step way. Each individual article in Learn React builds on the knowledge from the previous ones, so make sure not to add any "cyclical dependencies" between them. It is important that the reader can start with the first article and work their way to the last Learn React article without ever having to "look ahead" for a definition. This explains some ordering choices (e.g. that state is explained before events, or that "thinking in React" doesn't use refs). Learn React also serves as a reference manual for React concepts, so it is important to be very strict about their definitions and relationships between them.
2222

23-
**[API Reference](https://reactjs.org/apis)** is organized by APIs rather than concepts. It is intended to be exhaustive. Any corner cases or recommendations that were skipped for brevity in Learn React should be mentioned in the reference documentation for the corresponding APIs.
23+
**[API Reference](https://reactjs.org/apis/react)** is organized by APIs rather than concepts. It is intended to be exhaustive. Any corner cases or recommendations that were skipped for brevity in Learn React should be mentioned in the reference documentation for the corresponding APIs.
2424

2525
**Try to follow your own instructions.**
2626

beta/src/components/Layout/Footer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ export function Footer() {
8989
</FooterLink>
9090
</div>
9191
<div className="flex flex-col">
92-
<FooterLink href="/apis" isHeader={true}>
92+
<FooterLink href="/apis/react" isHeader={true}>
9393
API Reference
9494
</FooterLink>
95-
<FooterLink href="/apis">React APIs</FooterLink>
96-
<FooterLink href="/apis/reactdom">React DOM APIs</FooterLink>
95+
<FooterLink href="/apis/react">React APIs</FooterLink>
96+
<FooterLink href="/apis/react-dom">React DOM APIs</FooterLink>
9797
</div>
9898
<div className="flex flex-col sm:col-start-2 xl:col-start-4">
9999
<FooterLink href="/" isHeader={true}>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export default function Nav() {
182182
<NavLink href="/learn" isActive={section === 'learn'}>
183183
Learn
184184
</NavLink>
185-
<NavLink href="/apis" isActive={section === 'apis'}>
185+
<NavLink href="/apis/react" isActive={section === 'apis'}>
186186
API
187187
</NavLink>
188188
</div>

beta/src/components/Layout/Sidebar/SidebarLink.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ interface SidebarLinkProps {
1616
selected?: boolean;
1717
title: string;
1818
level: number;
19+
wip: boolean | undefined;
1920
icon?: React.ReactNode;
2021
heading?: boolean;
2122
isExpanded?: boolean;
@@ -28,6 +29,7 @@ export function SidebarLink({
2829
href,
2930
selected = false,
3031
title,
32+
wip,
3133
level,
3234
heading = false,
3335
isExpanded,
@@ -74,7 +76,12 @@ export function SidebarLink({
7476
}
7577
)}>
7678
{/* This here needs to be refactored ofc */}
77-
{title}
79+
<span
80+
className={cn({
81+
'text-gray-400 dark:text-gray-500': wip,
82+
})}>
83+
{title}
84+
</span>
7885
{isExpanded != null && !heading && !hideArrow && (
7986
<span
8087
className={cn('pr-1', {

beta/src/components/Layout/Sidebar/SidebarRouteTree.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function SidebarRouteTree({
100100
const expanded = expandedPath;
101101
return (
102102
<ul>
103-
{currentRoutes.map(({path, title, routes, heading}) => {
103+
{currentRoutes.map(({path, title, routes, wip, heading}) => {
104104
const pagePath = path && removeFromLast(path, '.');
105105
const selected = slug === pagePath;
106106

@@ -127,6 +127,7 @@ export function SidebarRouteTree({
127127
selected={selected}
128128
level={level}
129129
title={title}
130+
wip={wip}
130131
isExpanded={isExpanded}
131132
isBreadcrumb={expandedPath === path}
132133
hideArrow={isMobile}
@@ -151,6 +152,7 @@ export function SidebarRouteTree({
151152
selected={selected}
152153
level={level}
153154
title={title}
155+
wip={wip}
154156
/>
155157
</li>
156158
);

beta/src/components/Layout/useRouteMeta.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export interface RouteItem {
3030
path?: string;
3131
/** Whether the entry is a heading */
3232
heading?: boolean;
33+
/** Whether the page is under construction */
34+
wip?: boolean;
3335
/** List of sub-routes */
3436
routes?: RouteItem[];
3537
}

beta/src/components/MDX/ExpandableCallout.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import cn from 'classnames';
77
import {IconNote} from '../Icon/IconNote';
88
import {IconGotcha} from '../Icon/IconGotcha';
99

10-
type CalloutVariants = 'gotcha' | 'note';
10+
type CalloutVariants = 'gotcha' | 'note' | 'wip';
1111

1212
interface ExpandableCalloutProps {
1313
children: React.ReactNode;
@@ -32,6 +32,14 @@ const variantMap = {
3232
overlayGradient:
3333
'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)',
3434
},
35+
wip: {
36+
title: 'Under Construction',
37+
Icon: IconNote,
38+
containerClasses: 'bg-yellow-5 dark:bg-yellow-60 dark:bg-opacity-20',
39+
textColor: 'text-yellow-50 dark:text-yellow-40',
40+
overlayGradient:
41+
'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)',
42+
},
3543
};
3644

3745
function ExpandableCallout({children, type}: ExpandableCalloutProps) {

beta/src/components/MDX/HomepageHero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function HomepageHero() {
3030
</YouWillLearnCard>
3131
</div>
3232
<div className="flex flex-col justify-center">
33-
<YouWillLearnCard title="API Reference" path="/apis">
33+
<YouWillLearnCard title="API Reference" path="/apis/react">
3434
<p>
3535
Look up the API signatures of React Hooks, and see their shape
3636
using the visual code diagrams.

beta/src/components/MDX/MDXComponents.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ const UL = (p: JSX.IntrinsicElements['ul']) => (
6767
const Divider = () => (
6868
<hr className="my-6 block border-b border-border dark:border-border-dark" />
6969
);
70-
70+
const Wip = ({children}: {children: React.ReactNode}) => (
71+
<ExpandableCallout type="wip">{children}</ExpandableCallout>
72+
);
7173
const Gotcha = ({children}: {children: React.ReactNode}) => (
7274
<ExpandableCallout type="gotcha">{children}</ExpandableCallout>
7375
);
@@ -296,6 +298,7 @@ export const MDXComponents = {
296298
Diagram,
297299
DiagramGroup,
298300
Gotcha,
301+
Wip,
299302
HomepageHero,
300303
Illustration,
301304
IllustrationBlock,

beta/src/pages/apis/index.md

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

0 commit comments

Comments
 (0)