Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with react.dev @ 35530eea #533

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
adb958a
[Conferences] Add React Conf, order upcoming conferences by date (#6596)
mattcarrollcode Feb 1, 2024
ca98764
[Tutorial] Fix Sandbox download instructions to match current interfa…
victorferreira Feb 1, 2024
f96c528
Add form templates (#6592)
josephsavona Feb 1, 2024
b07fe2e
Tweak getting started guide (#6597)
rickhanlonii Feb 1, 2024
be8668c
removed Unnecessary Horizontal Scrollbar in Learn Section - Reacting …
saranyasri-s Feb 1, 2024
6ca0381
Update conferences.md (#6598)
dhairyadwivedi Feb 1, 2024
8ba8772
Initial Float docs for hoistable/semantic elements (#6486)
davidmccabe Feb 2, 2024
2372ecf
Initial docs for DOM static resource loading functions (#6459)
davidmccabe Feb 2, 2024
47c818c
feat (conferences) add react connection Paris (#6609)
Feb 5, 2024
c118938
Fix SandpackWithHTMLOutput to use src dir (#6613)
mattcarrollcode Feb 6, 2024
9a843b6
Add React Conf banner (#6595)
mattcarrollcode Feb 8, 2024
6d43bff
Fix scrollbar of SidebarNav to make it tappable (#6586)
tamonmon0417 Feb 10, 2024
6ae9922
Update index.md (#6622)
drex44 Feb 11, 2024
4ff80a5
Fix broken link (#6619)
lakshmi930 Feb 11, 2024
d46c360
Fix CSS discrepancy in issue #6508 (#6509)
hidaviddong Feb 11, 2024
bb3a0f5
Fix some typos (#6478)
romain-trotard Feb 11, 2024
a21a942
Fix typo (#6628)
0ldh Feb 14, 2024
2c4f382
Blog: What We've Been Working On – February 2024 (#6629)
rickhanlonii Feb 15, 2024
c1039b3
minor fixes from #6629 (#6630)
rickhanlonii Feb 15, 2024
9d3fc07
tweaks (#6631)
rickhanlonii Feb 15, 2024
bce6e55
Add warning page for RTR deprecation (#6632)
jackpope Feb 15, 2024
b66dece
Update react-labs-what-we-have-been-working-on-february-2024.md
sophiebits Feb 15, 2024
c608570
[blog] labs 2024 - minor grammer fix
mattcarrollcode Feb 16, 2024
1c06fcc
Update conferences.md to include Chain React 2024 (#6640)
robinheinze Feb 17, 2024
74c33a1
Fix typos in latest blog post (#6636)
stephan281094 Feb 17, 2024
156765f
Fix localhost link in script documentation (#6642)
devongovett Feb 17, 2024
35530ee
[typo] syntax looks wrong #6633 (#6641)
felipe-b-oliveira Feb 18, 2024
503285e
merging all conflicts
react-translations-bot Feb 19, 2024
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
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/0-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "🐛 Report a bug"
description: "Report a problem on the website."
title: "[Bug]: "
labels: ["bug: unconfirmed"]
body:
- type: textarea
attributes:
label: Summary
description: |
A clear and concise summary of what the bug is.
placeholder: |
Example bug report:
When I click the "Submit" button on "Feedback", nothing happens.
validations:
required: true
- type: input
attributes:
label: Page
description: |
What page(s) did you encounter this bug on?
placeholder: |
https://react.dev/
validations:
required: true
- type: textarea
attributes:
label: Details
description: |
Please provide any additional details about the bug.
placeholder: |
Example details:
The "Submit" button is unresponsive. I've tried refreshing the page and using a different browser, but the issue persists.
validations:
required: false
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/1-typo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "🤦 Typo or mistake"
description: "Report a typo or mistake in the docs."
title: "[Typo]: "
labels: ["type: typos"]
body:
- type: textarea
attributes:
label: Summary
description: |
A clear and concise summary of what the mistake is.
placeholder: |
Example:
The code example on the "useReducer" page includes an unused variable `nextId`.
validations:
required: true
- type: input
attributes:
label: Page
description: |
What page is the typo on?
placeholder: |
https://react.dev/
validations:
required: true
- type: textarea
attributes:
label: Details
description: |
Please provide a explanation for why this is a mistake.
placeholder: |
Example mistake:
In the "useReducer" section of the "API Reference" page, the code example under "Writing a reducer function" includes an unused variable `nextId` that should be removed.
validations:
required: false
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/2-suggestion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "💡 Suggestions"
description: "Suggest a new page, section, or edit for an existing page."
title: "[Suggestion]: "
labels: ["type: documentation"]
body:
- type: textarea
attributes:
label: Summary
description: |
A clear and concise summary of what we should add.
placeholder: |
Example:
Add a new page for how to use React with TypeScript.
validations:
required: true
- type: input
attributes:
label: Page
description: |
What page is this about?
placeholder: |
https://react.dev/
validations:
required: false
- type: textarea
attributes:
label: Details
description: |
Please provide a explanation for what you're suggesting.
placeholder: |
Example:
I think it would be helpful to have a page that explains how to use React with TypeScript. This could include a basic example of a component written in TypeScript, and a link to the TypeScript documentation.
validations:
required: true
116 changes: 116 additions & 0 deletions .github/ISSUE_TEMPLATE/3-framework.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: "📄 Suggest new framework"
description: "I am a framework author applying to be included as a recommended framework."
title: "[Framework]: "
labels: ["type: framework"]
body:
- type: markdown
attributes:
value: |
## Apply to be included as a recommended React framework
_This form is for framework authors to apply to be included as a recommended [React framework](https://react.dev/learn/start-a-new-react-project). If you are not a framework author, please contact the authors before submitting._
Our goal when recommending a framework is to start developers with a React project that solves common problems like code splitting, data fetching, routing, and HTML generation without any extra work later. We believe this will allow users to get started quickly with React, and scale their app to production.
While we understand that many frameworks may want to be featured, this page is not a place to advertise every possible React framework or all frameworks that you can add React to. There are many great frameworks that offer support for React that are not listed in our guides. The frameworks we recommend have invested significantly in the React ecosystem, and collaborated with the React team to be compatible with our [full-stack React architecture vision](https://react.dev/learn/start-a-new-react-project#which-features-make-up-the-react-teams-full-stack-architecture-vision).
To be included, frameworks must meet the following criteria:
- **Free & open-source**: must be open source and free to use.
- **Well maintained**. must be actively maintained, providing bug fixes and improvements.
- **Active community**: must have a sufficiently large and active community to support users.
- **Clear onboarding**: must have clear install steps to install the React version of the framework.
- **Ecosystem compatibility**: must support using the full range of libraries and tools in the React ecosystem.
- **Self-hosting option**: must support an option to self-host applications without losing access to features.
- **Developer experience**. must allow developers to be productive by supporting features like Fast Refresh.
- **User experience**. must provide built-in support for common problems like routing and data-fetching.
- **Compatible with our future vision for React**. React evolves over time, and frameworks that do not align with React’s direction risk isolating their users from the main React ecosystem over time. To be included on this page we must feel confident that the framework is setting its users up for success with React over time.
Please note, we have reviewed most of the popular frameworks available today, so it is unlikely we have not considered your framework already. But if you think we missed something, please complete the application below.
- type: input
attributes:
label: Name
description: |
What is the name of your framework?
validations:
required: true
- type: input
attributes:
label: Homepage
description: |
What is the URL of your homepage?
validations:
required: true
- type: input
attributes:
label: Install instructions
description: |
What is the URL of your getting started guide?
validations:
required: true
- type: dropdown
attributes:
label: Is your framework open source?
description: |
We only recommend free and open source frameworks.
options:
- 'No'
- 'Yes'
validations:
required: true
- type: textarea
attributes:
label: Well maintained
description: |
Please describe how your framework is actively maintained. Include recent releases, bug fixes, and improvements as examples.
validations:
required: true
- type: textarea
attributes:
label: Active community
description: |
Please describe your community. Include the size of your community, and links to community resources.
validations:
required: true
- type: textarea
attributes:
label: Clear onboarding
description: |
Please describe how a user can install your framework with React. Include links to any relevant documentation.
validations:
required: true
- type: textarea
attributes:
label: Ecosystem compatibility
description: |
Please describe any limitations your framework has with the React ecosystem. Include any libraries or tools that are not compatible with your framework.
validations:
required: true
- type: textarea
attributes:
label: Self-hosting option
description: |
Please describe how your framework supports self-hosting. Include any limitations to features when self-hosting. Also include whether you require a server to deploy your framework.
validations:
required: true
- type: textarea
attributes:
label: Developer Experience
description: |
Please describe how your framework provides a great developer experience. Include any limitations to React features like React DevTools, Chrome DevTools, and Fast Refresh.
validations:
required: true
- type: textarea
attributes:
label: User Experience
description: |
Please describe how your framework helps developers create high quality user experiences by solving common use-cases. Include specifics for how your framework offers built-in support for code-splitting, routing, HTML generation, and data-fetching in a way that avoids client/server waterfalls by default. Include details on how you offer features such as SSG and SSR.
validations:
required: true
- type: textarea
attributes:
label: Compatible with our future vision for React
description: |
Please describe how your framework aligns with our future vision for React. Include how your framework will evolve with React over time, and your plans to support future React features like React Server Components.
validations:
required: true
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
contact_links:
- name: 📃 Bugs in React
url: https://github.com/facebook/react/issues/new/choose
about: This issue tracker is not for bugs in React. Please file React issues here.
- name: 🤔 Questions and Help
url: https://reactjs.org/community/support.html
about: This issue tracker is not for support questions. Please refer to the React community's help and discussion forums.
2 changes: 1 addition & 1 deletion src/components/Layout/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export function Page({children, toc, routeTree, meta, section}: PageProps) {
'grid grid-cols-only-content lg:grid-cols-sidebar-content 2xl:grid-cols-sidebar-content-toc'
)}>
{showSidebar && (
<div className="lg:-mt-16">
<div className="lg:-mt-16 z-10">
<div className="fixed top-0 py-0 shadow lg:pt-16 lg:sticky start-0 end-0 lg:shadow-none">
<SidebarNav
key={section}
Expand Down
3 changes: 2 additions & 1 deletion src/components/MDX/InlineCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import cn from 'classnames';

interface InlineCodeProps {
isLink: boolean;
isLink?: boolean;
meta?: string;
}
function InlineCode({
isLink,
Expand Down
2 changes: 2 additions & 0 deletions src/components/MDX/MDXComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Link from './Link';
import {PackageImport} from './PackageImport';
import Recap from './Recap';
import Sandpack from './Sandpack';
import SandpackWithHTMLOutput from './SandpackWithHTMLOutput';
import Diagram from './Diagram';
import DiagramGroup from './DiagramGroup';
import SimpleCallout from './SimpleCallout';
Expand Down Expand Up @@ -434,6 +435,7 @@ export const MDXComponents = {
Recap,
Recipes,
Sandpack,
SandpackWithHTMLOutput,
TeamMember,
TerminalBlock,
YouWillLearn,
Expand Down
5 changes: 4 additions & 1 deletion src/components/MDX/Sandpack/createFileMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export const SUPPORTED_FILES = [AppJSPath, StylesCSSPath];
export const createFileMap = (codeSnippets: any) => {
return codeSnippets.reduce(
(result: Record<string, SandpackFile>, codeSnippet: React.ReactElement) => {
if ((codeSnippet.type as any).mdxName !== 'pre') {
if (
(codeSnippet.type as any).mdxName !== 'pre' &&
codeSnippet.type !== 'pre'
) {
return result;
}
const {props} = codeSnippet.props.children;
Expand Down
85 changes: 85 additions & 0 deletions src/components/MDX/SandpackWithHTMLOutput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import {Children, memo} from 'react';
import InlineCode from './InlineCode';
import Sandpack from './Sandpack';

const ShowRenderedHTML = `
import { renderToStaticMarkup } from 'react-dom/server';
import formatHTML from './formatHTML.js';

export default function ShowRenderedHTML({children}) {
const markup = renderToStaticMarkup(
<html>
<head />
<body>{children}</body>
</html>
);
return (
<>
<h1>Rendered HTML:</h1>
<pre>
{formatHTML(markup)}
</pre>
</>
);
}`;

const formatHTML = `
import format from 'html-format';

export default function formatHTML(markup) {
// Cheap tricks to format the HTML readably -- haven't been able to
// find a package that runs in browser and prettifies the HTML if it
// lacks line-breaks.
return format(markup
.replace('<html>', '<html>\\n')
.replace('<head>', '<head>\\n')
.replaceAll(/<\\/script>/g, '<\\/script>\\n')
.replaceAll(/<style([^>]*)\\/>/g, '<style $1/>\\n\\n')
.replaceAll(/<\\/style>/g, '\\n <\\/style>\\n')
.replaceAll(/<link([^>]*)\\/>/g, '<link $1/>\\n')
.replaceAll(/<meta([^/]*)\\/>/g, '<meta $1/>\\n')
.replace('</head>', '</head>\\n')
.replace('<body>', '<body>\\n')
.replace('</body>', '\\n</body>\\n')
.replace('</h1>', '</h1>\\n')
);
}
`;

const packageJSON = `
{
"dependencies": {
"react": "18.3.0-canary-6db7f4209-20231021",
"react-dom": "18.3.0-canary-6db7f4209-20231021",
"react-scripts": "^5.0.0",
"html-format": "^1.1.2"
},
"main": "/index.js",
"devDependencies": {}
}
`;

// Intentionally not a React component because <Sandpack> will read
// through its childrens' props. This imitates the output of ```
// codeblocks in MDX.
function createFile(meta: string, source: string) {
return (
<pre key={meta}>
<InlineCode meta={meta} className="language-js">
{source}
</InlineCode>
</pre>
);
}

export default memo(function SandpackWithHTMLOutput(
props: React.ComponentProps<typeof Sandpack>
) {
const children = [
...Children.toArray(props.children),
createFile('src/ShowRenderedHTML.js', ShowRenderedHTML),
createFile('src/formatHTML.js hidden', formatHTML),
createFile('package.json hidden', packageJSON),
];
return <Sandpack {...props}>{children}</Sandpack>;
});
8 changes: 3 additions & 5 deletions src/components/SocialBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {useRef, useEffect} from 'react';
import cn from 'classnames';
import {ExternalLink} from './ExternalLink';

const bannerText = 'Support Ukraine 🇺🇦';
const bannerLink = 'https://opensource.fb.com/support-ukraine';
const bannerLinkText = 'Help Provide Humanitarian Aid to Ukraine';
const bannerText = 'Join us for React Conf on May 15-16.';
const bannerLink = 'https://conf.react.dev/';
const bannerLinkText = 'Learn more.';

export default function SocialBanner() {
const ref = useRef<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -39,9 +39,7 @@ export default function SocialBanner() {
<ExternalLink
className="ms-0 sm:ms-1 text-link dark:text-link-dark hover:underline"
href={bannerLink}>
<div className="inline sm:hidden">🇺🇦 </div>
{bannerLinkText}
<span className="hidden sm:inline">.</span>
</ExternalLink>
</div>
);
Expand Down
Loading
Loading