Skip to content

Commit 4fb58b4

Browse files
authored
docs(en): merge reactjs.org/main into zh-hans.reactjs.org/main @ f625b86
2 parents 540c99d + 42eadf0 commit 4fb58b4

File tree

11 files changed

+44
-57
lines changed

11 files changed

+44
-57
lines changed

beta/.husky/pre-commit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
. "$(dirname "$0")/_/husky.sh"
33

44
cd beta
5-
yarn generate-ids
6-
git add -u src/pages/**/*.md
5+
# yarn generate-ids
6+
# git add -u src/pages/**/*.md
77
yarn prettier
8-
yarn lint:fix
8+
yarn lint:fix

beta/src/components/Layout/Page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ export function Page({routeTree, children}: PageProps) {
2525

2626
<div className="flex flex-1 w-full h-full self-stretch">
2727
<div className="w-full min-w-0">
28-
<main
29-
className="flex flex-1 self-stretch flex-col items-end"
30-
style={{justifyContent: 'space-around'}}>
28+
<main className="flex flex-1 self-stretch flex-col items-end justify-around">
3129
{children}
3230
<Footer />
3331
</main>

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function Sidebar({isMobileOnly}: {isMobileOnly?: boolean}) {
1818
const {menuRef, isOpen} = React.useContext(MenuContext);
1919
const isMobileSidebar = useMediaQuery(SIDEBAR_BREAKPOINT);
2020
let routeTree = React.useContext(SidebarContext);
21-
const isHidden = isMobileOnly && !isMobileSidebar;
21+
const isHidden = isMobileSidebar ? !isOpen : false;
2222

2323
// HACK. Fix up the data structures instead.
2424
if ((routeTree as any).routes.length === 1) {
@@ -62,14 +62,10 @@ export function Sidebar({isMobileOnly}: {isMobileOnly?: boolean}) {
6262
return (
6363
<aside
6464
className={cn(
65-
`lg:flex-grow lg:flex flex-col w-full pt-4 pb-8 lg:pb-0 lg:max-w-xs fixed lg:sticky bg-wash dark:bg-wash-dark z-10`,
65+
`lg:flex-grow lg:flex flex-col w-full pt-4 pb-8 lg:pb-0 lg:max-w-xs fixed lg:sticky bg-wash dark:bg-wash-dark z-10 top-0`,
6666
isOpen ? 'block z-40' : 'hidden lg:block'
6767
)}
68-
aria-hidden={isHidden ? 'true' : 'false'}
69-
style={{
70-
top: 0,
71-
visibility: isHidden ? 'hidden' : undefined,
72-
}}>
68+
aria-hidden={isHidden}>
7369
<div className="px-5">
7470
<Search />
7571
</div>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import * as React from 'react';
6+
import cn from 'classnames';
67
import {RouteItem} from 'components/Layout/useRouteMeta';
78
import {useRouter} from 'next/router';
89
import {removeFromLast} from 'utils/removeFromLast';
@@ -59,8 +60,8 @@ function CollapseWrapper({
5960
return (
6061
<div
6162
ref={ref}
63+
className={cn(isExpanded ? 'opacity-100' : 'opacity-50')}
6264
style={{
63-
opacity: isExpanded ? 1 : 0.5,
6465
transition: `opacity ${duration}ms ease-in-out`,
6566
animation: `nav-fadein ${duration}ms ease-in-out`,
6667
}}>

beta/src/components/MDX/APIAnatomy.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ export function AnatomyStep({
101101
const color = colors[stepNumber - 1];
102102
return (
103103
<div
104-
style={{
105-
borderLeftColor: color.hex,
106-
}}
107104
className={cn(
108105
'border-l-4 rounded-lg px-5 pt-8 pb-2 bg-opacity-5 shadow-inner',
109106
color.border,

beta/src/components/MDX/Heading.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ const Heading = forwardRefWithAs<HeadingProps, 'div'>(function Heading(
2727
{isPageAnchor && (
2828
<a
2929
href={`#${id}`}
30-
className={anchorClassName}
31-
aria-hidden={true}
32-
style={{
33-
display: Comp === 'h1' ? 'none' : 'inline-block',
34-
}}>
30+
className={cn(
31+
anchorClassName,
32+
Comp === 'h1' ? 'hidden' : 'inline-block'
33+
)}
34+
aria-hidden="true">
3535
<svg
3636
width="1em"
3737
height="1em"

beta/src/components/MDX/Sandpack/Preview.tsx

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,6 @@ export function Preview({
100100
: null;
101101
const hideContent = !isReady || error;
102102

103-
// Allow content to be scrolled if it's too high to fit.
104-
// Note we don't want this in the expanded state
105-
// because it breaks position: sticky (and isn't needed anyway).
106-
// We also don't want this for errors because they expand
107-
// parent and making them scrollable is confusing.
108-
let overflow;
109-
if (!isExpanded && !error && isReady) {
110-
overflow = 'auto';
111-
}
112-
113103
// WARNING:
114104
// The layout and styling here is convoluted and really easy to break.
115105
// If you make changes to it, you need to test different cases:
@@ -136,9 +126,14 @@ export function Preview({
136126
}}>
137127
<div
138128
className={cn(
139-
'p-0 sm:p-2 md:p-4 lg:p-8 bg-card dark:bg-wash-dark h-full relative rounded-b-lg lg:rounded-b-none'
140-
)}
141-
style={{overflow}}>
129+
'p-0 sm:p-2 md:p-4 lg:p-8 bg-card dark:bg-wash-dark h-full relative rounded-b-lg lg:rounded-b-none',
130+
// Allow content to be scrolled if it's too high to fit.
131+
// Note we don't want this in the expanded state
132+
// because it breaks position: sticky (and isn't needed anyway).
133+
// We also don't want this for errors because they expand
134+
// parent and making them scrollable is confusing.
135+
!isExpanded && !error && isReady ? 'overflow-auto' : null
136+
)}>
142137
<div
143138
style={{
144139
padding: 'initial',
@@ -151,31 +146,32 @@ export function Preview({
151146
}}>
152147
<iframe
153148
ref={iframeRef}
154-
className="rounded-t-none bg-white shadow-md sm:rounded-lg w-full max-w-full"
155-
title="Sandbox Preview"
156-
style={{
157-
height: iframeComputedHeight || '100%',
158-
position: hideContent ? 'absolute' : undefined,
149+
className={cn(
150+
'rounded-t-none bg-white shadow-md sm:rounded-lg w-full max-w-full',
159151
// We can't *actually* hide content because that would
160152
// break calculating the computed height in the iframe
161153
// (which we're using for autosizing). This is noticeable
162154
// if you make a compiler error and then fix it with code
163155
// that expands the content. You want to measure that.
164-
opacity: hideContent ? 0 : 1,
165-
pointerEvents: hideContent ? 'none' : undefined,
156+
hideContent
157+
? 'absolute opacity-0 pointer-events-none'
158+
: 'opacity-100'
159+
)}
160+
title="Sandbox Preview"
161+
style={{
162+
height: iframeComputedHeight || '100%',
166163
zIndex: isExpanded ? 'initial' : -1,
167164
}}
168165
/>
169166
</div>
170167
{error && (
171168
<div
172-
className="p-2"
173-
style={{
169+
className={cn(
170+
'p-2',
174171
// This isn't absolutely positioned so that
175172
// the errors can also expand the parent height.
176-
position: isExpanded ? 'sticky' : undefined,
177-
top: isExpanded ? '2rem' : '',
178-
}}>
173+
isExpanded ? 'sticky top-8' : null
174+
)}>
179175
<Error error={error} />
180176
</div>
181177
)}

beta/src/components/Search.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ function Hit({hit, children}: any) {
3131
function Kbd(props: {children?: React.ReactNode}) {
3232
return (
3333
<kbd
34-
className="border border-transparent mr-1 bg-wash dark:bg-wash-dark text-gray-30 align-middle p-0 inline-flex justify-center items-center text-xs text-center rounded"
35-
style={{width: '2.25em', height: '2.25em'}}
34+
className="h-6 w-6 border border-transparent mr-1 bg-wash dark:bg-wash-dark text-gray-30 align-middle p-0 inline-flex justify-center items-center text-xs text-center rounded"
3635
{...props}
3736
/>
3837
);

beta/src/pages/community/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Stack Overflow 是非常受欢迎的论坛,在论坛中,你可以提出代
1818

1919
<!--
2020
21-
TODO: decide on the criteria for inclusion before uncommenting.
21+
TODO: decide on the criteria for inclusion before uncommenting. (Change Popular Discussion Forums into heading while un-commenting)
2222
23-
## 热门讨论区 {/*popular-discussion-forums*/}
23+
热门讨论区
2424
2525
许多论坛是讨论最佳实践、应用架构以及 React 新特性的好地方。但如果你想讨论的是代码级问题,通常 Stack Overflow 会更合适。
2626

beta/src/pages/learn/javascript-in-jsx-with-curly-braces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ The next time you see `{{` and `}}` in JSX, know that it's nothing more than an
165165
166166
<Gotcha>
167167
168-
Inline `style` properties are written in camelCase. For example, HTML `<ul style="background-color: black"`> would be written as `<ul style={{ backgroundColor: 'black' }}>` in your component.
168+
Inline `style` properties are written in camelCase. For example, HTML `<ul style="background-color: black">` would be written as `<ul style={{ backgroundColor: 'black' }}>` in your component.
169169
170170
</Gotcha>
171171

content/community/conferences.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ redirect_from:
1212

1313
## 即将举行的会议 {#upcoming-conferences}
1414

15-
### React India 2021 {#react-india-2021}
16-
November 12-13, 2021 - remote event
17-
18-
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia/) - [LinkedIn](https://www.linkedin.com/showcase/14545585) - [YouTube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w/videos)
19-
2015
### React Conf 2021 {#react-conf-2021}
2116
December 8, 2021 - remote event (replay event on December 9)
2217

@@ -49,6 +44,11 @@ June 17 & 21, 2022. In-person in Amsterdam, Netherlands + remote first interacti
4944

5045
## 往届会议 {#past-conferences}
5146

47+
### React India 2021 {#react-india-2021}
48+
November 12-13, 2021 - remote event
49+
50+
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia/) - [LinkedIn](https://www.linkedin.com/showcase/14545585) - [YouTube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w/videos)
51+
5252
### < React Global > by Geekle {#react-global-2021}
5353
November 3-4, 2021 - remote event
5454

0 commit comments

Comments
 (0)