Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5fae61d
[Beta] Change index page wording
gaearon May 9, 2022
951fae3
added meetup (#4655)
piotrpospiech May 12, 2022
6db368a
Relegate Reactathon 2022 to the annals of history (#4663)
erikras May 17, 2022
fc88516
[Beta] Adds eslint integration on Sandpack (#4665)
danilowoz May 18, 2022
dbeeac8
Fix patch
gaearon May 18, 2022
3ab1245
[beta] Sandpack - new bundler (#4458)
danilowoz May 18, 2022
199e9ca
[Beta] Fix error precedence (#4666)
gaearon May 18, 2022
3aac8c5
use proper code block (#4671)
harish-sethuraman May 22, 2022
20ad0e8
[Beta] Lazy-load linter code (#4675)
gaearon May 23, 2022
1cf3c1b
chore(sandpack): remove unused code (#4674)
danilowoz May 23, 2022
64a2ede
fix(eslint): exclude parsing errors (#4673)
danilowoz May 23, 2022
79d50e0
Fix lint
gaearon May 23, 2022
2ece592
[Beta] Load CodeMirror linter plugin lazily (#4678)
gaearon May 23, 2022
9cee632
[Beta] Do not bundle built-in ESLint rules (#4679)
gaearon May 23, 2022
4e62999
[Beta] Update Next and React (#4680)
gaearon May 23, 2022
26d7dfb
[Beta] Build for modern browsers (#4682)
gaearon May 23, 2022
663f975
[Beta] Serve fonts from same domain
gaearon May 24, 2022
6e67dfb
Fix
gaearon May 24, 2022
f1f545c
[Beta] Lazy-load analytics
gaearon May 24, 2022
603c6c3
[Beta] Fix lint re-running every second (#4687)
gaearon May 25, 2022
e49a96f
Fix TS
gaearon May 25, 2022
4708fe6
[Beta] Slightly reduce bundle size (#4688)
gaearon May 25, 2022
47eea56
[Beta] Enable Selective Hydration in more places (#4689)
gaearon May 25, 2022
cec374f
[Beta] Remove styled-jsx (#4690)
gaearon May 25, 2022
53de0f7
[Beta] Upgrade React Types & Fix resulting type issues (#4694)
xiel May 26, 2022
e6dfdd3
[Beta] Drop next/dynamic usage (#4695)
SukkaW May 26, 2022
c209465
Change text "Click me" to somthing else (#4697)
surjithctly May 26, 2022
ee75472
[Beta] Fix editor re-renders on lint error (#4699)
gaearon May 26, 2022
9721c9d
Add loading indicator to sidebar links (#4693)
yousefelgoharyx May 27, 2022
2d374f8
[beta] fix(eslint): messages severity (#4702)
danilowoz May 27, 2022
37ffccc
Fixed language error (#4701)
aayush-sr May 27, 2022
81d4f68
docs: fix typos (#4706)
tbroadley May 28, 2022
d522a5f
Add Turborepo to custom toolchains for monorepos. (#4705)
leerob May 28, 2022
6eff118
Update start-a-new-react-project.md (#4712)
anwarali7 May 30, 2022
2d46af6
Update SandpackRoot.tsx (#4715)
danilowoz Jun 1, 2022
0306da6
Revert "Update SandpackRoot.tsx (#4715)" (#4716)
gaearon Jun 1, 2022
1302ad7
Update SandpackRoot.tsx (#4717)
DeMoorJasper Jun 1, 2022
9a5bf3e
Fix typo
gaearon Jun 3, 2022
537b286
Update the URL of Yarn's installation instructions (#4723)
xfq Jun 6, 2022
486087f
Remove social links from prev React Europe events (#4724)
jamiebuilds Jun 6, 2022
0831df4
add remix conf (#4726)
kentcdodds Jun 7, 2022
022c8ff
[Beta] Add some types (#4728)
ycjcl868 Jun 8, 2022
678caa5
Remove unused header
gaearon Jun 9, 2022
4bfd896
docs: fix optional argument representation (#4732)
kbrandwijk Jun 10, 2022
11a5ea0
typo (#4725)
cdztt Jun 10, 2022
6240fed
docs: fix incomplete sentences in useref.md (#4731)
jakeboone02 Jun 10, 2022
e4d807d
[Beta] fix(navigation): ui tweak (#4709)
danilowoz Jun 10, 2022
6d96542
[Beta] Add console to sandboxes (#4672)
harish-sethuraman Jun 10, 2022
5f55848
merging all conflicts
react-translations-bot Jun 13, 2022
8947f96
fix conflict
bugtender Jun 13, 2022
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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.16.1
12.22.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This repo contains the source code and documentation powering [reactjs.org](http

1. Git
1. Node: any 12.x version starting with v12.0.0 or greater
1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
1. Yarn v1: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
1. A fork of the repo (for any contributions)
1. A clone of the [reactjs.org repo](https://github.com/reactjs/reactjs.org) on your local machine

Expand Down
5 changes: 5 additions & 0 deletions beta/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ yarn-error.log*

# vercel
.vercel

# external fonts
public/fonts/Optimistic_Display_W_Lt.woff2
public/fonts/Optimistic_Display_W_Md.woff2
public/fonts/Optimistic_Display_W_Bd.woff2
50 changes: 39 additions & 11 deletions beta/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,30 @@ const path = require('path');
const {remarkPlugins} = require('./plugins/markdownToHtml');
const redirects = require('./src/redirects.json');

module.exports = {
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'],
experimental: {
plugins: true,
// TODO: this doesn't work because https://github.com/vercel/next.js/issues/30714
concurrentFeatures: false,
scrollRestoration: true,
legacyBrowsers: false,
browsersListForSwc: true,
},
async redirects() {
return redirects.redirects;
},
rewrites() {
return [
{
source: '/feed.xml',
destination: '/_next/static/feed.xml',
},
];
},
// TODO: this causes extra router.replace() on every page.
// Let's disable until we figure out what's going on.
// rewrites() {
// return [
// {
// source: '/feed.xml',
// destination: '/_next/static/feed.xml',
// },
// ];
// },
webpack: (config, {dev, isServer, ...options}) => {
if (process.env.ANALYZE) {
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
Expand All @@ -38,6 +43,27 @@ module.exports = {
);
}

// Don't bundle the shim unnecessarily.
config.resolve.alias['use-sync-external-store/shim'] = 'react';

const {IgnorePlugin} = require('webpack');
config.plugins.push(
new IgnorePlugin({
checkResource(resource, context) {
if (
/\/eslint\/lib\/rules$/.test(context) &&
/\.\/[\w-]+(\.js)?$/.test(resource)
) {
// Skips imports of built-in rules that ESLint
// tries to carry into the bundle by default.
// We only want the engine and the React rules.
return true;
}
return false;
},
})
);

// Add our custom markdown loader in order to support frontmatter
// and layout
config.module.rules.push({
Expand All @@ -57,3 +83,5 @@ module.exports = {
return config;
},
};

module.exports = nextConfig;
15 changes: 8 additions & 7 deletions beta/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"analyze": "ANALYZE=true next build",
"dev": "next",
"build": "next build && node ./scripts/generateRSS.js && node ./scripts/generateRedirects.js",
"build": "next build && node ./scripts/generateRSS.js && node ./scripts/generateRedirects.js && node ./scripts/downloadFonts.js",
"lint": "next lint",
"lint:fix": "next lint --fix",
"format:source": "prettier --config .prettierrc --write \"{plugins,src}/**/*.{js,ts,jsx,tsx,css}\"",
Expand All @@ -22,7 +22,7 @@
"check-all": "npm-run-all prettier lint:fix tsc"
},
"dependencies": {
"@codesandbox/sandpack-react": "v0.14.3-experimental.1",
"@codesandbox/sandpack-react": "v0.19.8-experimental.4",
"@docsearch/css": "3.0.0-alpha.41",
"@docsearch/react": "3.0.0-alpha.41",
"@headlessui/react": "^1.3.0",
Expand All @@ -33,23 +33,24 @@
"debounce": "^1.2.1",
"ga-lite": "^2.1.4",
"github-slugger": "^1.3.0",
"next": "^12.0.10",
"next": "12.1.7-canary.11",
"parse-numeric-range": "^1.2.0",
"react": "experimental",
"react": "0.0.0-experimental-82c64e1a4-20220520",
"react-collapsed": "3.1.0",
"react-dom": "experimental",
"react-dom": "0.0.0-experimental-82c64e1a4-20220520",
"scroll-into-view-if-needed": "^2.2.25"
},
"devDependencies": {
"@mdx-js/loader": "^1.6.16",
"@types/body-scroll-lock": "^2.6.1",
"@types/classnames": "^2.2.10",
"@types/debounce": "^1.2.1",
"@types/github-slugger": "^1.3.0",
"@types/mdx-js__react": "^1.5.2",
"@types/node": "^14.6.4",
"@types/parse-numeric-range": "^0.0.1",
"@types/react": "^16.9.46",
"@types/react-dom": "^16.9.8",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.5",
"@typescript-eslint/eslint-plugin": "2.x",
"@typescript-eslint/parser": "2.x",
"asyncro": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@codesandbox/sandpack-react/dist/esm/index.js b/node_modules/@codesandbox/sandpack-react/dist/esm/index.js
index 4acfc3a..d00e57d 100644
index ced9bd3..7e5e366 100644
--- a/node_modules/@codesandbox/sandpack-react/dist/esm/index.js
+++ b/node_modules/@codesandbox/sandpack-react/dist/esm/index.js
@@ -566,17 +566,16 @@ var REACT_TEMPLATE = {
Expand Down
17 changes: 17 additions & 0 deletions beta/scripts/downloadFonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*/

const {execSync} = require('child_process');

// So that we don't need to check them into the repo.
// Serving them from the same domain is better for perf so do this on deploy.
execSync(
'curl https://conf.reactjs.org/fonts/Optimistic_Display_W_Lt.woff2 --output public/fonts/Optimistic_Display_W_Lt.woff2'
);
execSync(
'curl https://conf.reactjs.org/fonts/Optimistic_Display_W_Md.woff2 --output public/fonts/Optimistic_Display_W_Md.woff2'
);
execSync(
'curl https://conf.reactjs.org/fonts/Optimistic_Display_W_Bd.woff2 --output public/fonts/Optimistic_Display_W_Bd.woff2'
);
5 changes: 2 additions & 3 deletions beta/src/components/Layout/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import * as React from 'react';
import {useRouter} from 'next/router';
// @ts-ignore
import galite from 'ga-lite';
import {ga} from '../../utils/analytics';

export function Feedback({onSubmit = () => {}}: {onSubmit?: () => void}) {
const {pathname} = useRouter();
Expand Down Expand Up @@ -48,7 +47,7 @@ const thumbsDownIcon = (
function sendGAEvent(isPositive: boolean) {
// Fragile. Don't change unless you've tested the network payload
// and verified that the right events actually show up in GA.
galite(
ga(
'send',
'event',
'button',
Expand Down
5 changes: 4 additions & 1 deletion beta/src/components/Layout/Nav/MobileNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export function MobileNav() {
API
</TabButton>
</div>
<SidebarRouteTree routeTree={tree as RouteItem} isMobile={true} />
{/* No fallback UI so need to be careful not to suspend directly inside. */}
<React.Suspense fallback={null}>
<SidebarRouteTree routeTree={tree as RouteItem} isMobile={true} />
</React.Suspense>
</>
);
}
Expand Down
17 changes: 10 additions & 7 deletions beta/src/components/Layout/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ export function Page({routeTree, children}: PageProps) {
<Sidebar />
</div>

<div className="flex flex-1 w-full h-full self-stretch">
<div className="w-full min-w-0">
<main className="flex flex-1 self-stretch mt-16 sm:mt-10 flex-col items-end justify-around">
{children}
<Footer />
</main>
{/* No fallback UI so need to be careful not to suspend directly inside. */}
<React.Suspense fallback={null}>
<div className="flex flex-1 w-full h-full self-stretch">
<div className="w-full min-w-0">
<main className="flex flex-1 self-stretch mt-16 sm:mt-10 flex-col items-end justify-around">
{children}
<Footer />
</main>
</div>
</div>
</div>
</React.Suspense>
</div>
</SidebarContext.Provider>
</MenuProvider>
Expand Down
5 changes: 4 additions & 1 deletion beta/src/components/Layout/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export function Sidebar() {
{isMobileSidebar ? (
<MobileNav />
) : (
<SidebarRouteTree routeTree={routeTree} />
/* No fallback UI so need to be careful not to suspend directly inside. */
<React.Suspense fallback={null}>
<SidebarRouteTree routeTree={routeTree} />
</React.Suspense>
)}
</nav>
<div className="sticky bottom-0 hidden lg:block">
Expand Down
5 changes: 5 additions & 0 deletions beta/src/components/Layout/Sidebar/SidebarLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface SidebarLinkProps {
isExpanded?: boolean;
isBreadcrumb?: boolean;
hideArrow?: boolean;
isPending: boolean;
}

export function SidebarLink({
Expand All @@ -32,6 +33,7 @@ export function SidebarLink({
isExpanded,
isBreadcrumb,
hideArrow,
isPending,
}: SidebarLinkProps) {
const ref = React.useRef<HTMLAnchorElement>(null);
const isMobile = useIsMobile();
Expand Down Expand Up @@ -67,8 +69,11 @@ export function SidebarLink({
!selected && !heading,
'text-base text-link dark:text-link-dark bg-highlight dark:bg-highlight-dark border-blue-40 hover:bg-highlight hover:text-link dark:hover:bg-highlight-dark dark:hover:text-link-dark':
selected,
'dark:bg-gray-60 bg-gray-3 dark:hover:bg-gray-60 hover:bg-gray-3':
isPending,
}
)}>
{/* This here needs to be refactored ofc */}
{title}
{isExpanded != null && !heading && !hideArrow && (
<span
Expand Down
6 changes: 5 additions & 1 deletion beta/src/components/Layout/Sidebar/SidebarRouteTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {useRouteMeta} from '../useRouteMeta';
import {SidebarLink} from './SidebarLink';
import useCollapse from 'react-collapsed';
import {useLayoutEffect} from 'react';
import usePendingRoute from 'hooks/usePendingRoute';

interface SidebarRouteTreeProps {
isMobile?: boolean;
Expand Down Expand Up @@ -77,8 +78,9 @@ export function SidebarRouteTree({
}: SidebarRouteTreeProps) {
const {breadcrumbs} = useRouteMeta(routeTree);
const {pathname} = useRouter();
const slug = pathname;
const pendingRoute = usePendingRoute();

const slug = pathname;
const currentRoutes = routeTree.routes as RouteItem[];
const expandedPath = currentRoutes.reduce(
(acc: string | undefined, curr: RouteItem) => {
Expand Down Expand Up @@ -121,6 +123,7 @@ export function SidebarRouteTree({
<SidebarLink
key={`${title}-${path}-${level}-link`}
href={pagePath}
isPending={pendingRoute === pagePath}
selected={selected}
level={level}
title={title}
Expand All @@ -143,6 +146,7 @@ export function SidebarRouteTree({
return (
<li key={`${title}-${path}-${level}-link`}>
<SidebarLink
isPending={pendingRoute === pagePath}
href={pagePath}
selected={selected}
level={level}
Expand Down
13 changes: 1 addition & 12 deletions beta/src/components/Layout/Toc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function Toc({
<h2 className="mb-3 lg:mb-3 uppercase tracking-wide font-bold text-sm text-secondary dark:text-secondary-dark px-4 w-full">
On this page
</h2>
<div className="toc h-full overflow-y-auto pl-4">
<div className="h-full overflow-y-auto pl-4 max-h-[calc(100vh-7.5rem)]">
<ul className="space-y-2 pb-16">
{headings &&
headings.length > 0 &&
Expand Down Expand Up @@ -65,17 +65,6 @@ export function Toc({
})}
</ul>
</div>
<style jsx global>{`
.toc {
/** Screen - nav - toc offset */
max-height: calc(100vh - 7.5rem);
}
.toc-link > code {
overflow-wrap: break-word;
white-space: pre-wrap;
font-size: 90%;
}
`}</style>
</nav>
);
}
2 changes: 1 addition & 1 deletion beta/src/components/Layout/useMediaQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {useState, useCallback, useEffect} from 'react';
const useMediaQuery = (width: number) => {
const [targetReached, setTargetReached] = useState(false);

const updateTarget = useCallback((e) => {
const updateTarget = useCallback((e: MediaQueryListEvent) => {
if (e.matches) {
setTargetReached(true);
} else {
Expand Down
2 changes: 1 addition & 1 deletion beta/src/components/Layout/useTocHighlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const TOP_OFFSET = 75;

export function getHeaderAnchors(): HTMLAnchorElement[] {
return Array.prototype.filter.call(
document.getElementsByClassName(siteConfig.headerIdConfig.className),
document.getElementsByClassName('mdx-header-anchor'),
function (testElement) {
return (
testElement.parentNode.nodeName === 'H1' ||
Expand Down
4 changes: 2 additions & 2 deletions beta/src/components/MDX/Challenges/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, {createRef} from 'react';
import cn from 'classnames';
import {IconChevron} from 'components/Icon/IconChevron';
import {ChallengeContents} from './Challenges';
const debounce = require('debounce');
import {debounce} from 'debounce';

export function Navigation({
challenges,
Expand Down Expand Up @@ -122,7 +122,7 @@ export function Navigation({
onClick={handleScrollRight}
aria-label="Scroll right"
className={cn(
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-r-lg',
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-r',
{
'text-primary dark:text-primary-dark': canScrollRight,
'text-gray-30': !canScrollRight,
Expand Down
Loading