Skip to content

Commit fcfed55

Browse files
committed
docs(en): merging all conflicts
2 parents 6f279a2 + a5181c2 commit fcfed55

33 files changed

+526
-189
lines changed
16.3 KB
Loading

src/components/DocsFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function FooterLink({
8080
/>
8181
<div className="flex flex-col overflow-hidden">
8282
<span className="text-sm font-bold tracking-wide no-underline uppercase text-secondary dark:text-secondary-dark group-focus:text-link dark:group-focus:text-link-dark group-focus:text-opacity-100">
83-
{type}
83+
{type === 'Previous' ? 'Previous' : 'Next'}
8484
</span>
8585
<span className="text-lg break-words group-hover:underline">
8686
{title}

src/components/Icon/IconArrowSmall.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const IconArrowSmall = memo<
1919
const classes = cn(className, {
2020
'rotate-180': displayDirection === 'left',
2121
'rotate-180 rtl:rotate-0': displayDirection === 'start',
22+
'rtl:rotate-180': displayDirection === 'end',
2223
'rotate-90': displayDirection === 'down',
2324
});
2425
return (

src/components/Icon/IconExperimental.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {memo} from 'react';
66

77
export const IconExperimental = memo<
88
JSX.IntrinsicElements['svg'] & {title?: string; size?: 's' | 'md'}
9-
>(function IconCanary(
9+
>(function IconExperimental(
1010
{className, title, size} = {
1111
className: undefined,
1212
title: undefined,

src/components/MDX/Challenges/Navigation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function Navigation({
108108
onClick={handleScrollLeft}
109109
aria-label="Scroll left"
110110
className={cn(
111-
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-l border-gray-20 border-r rtl:rotate-180',
111+
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-l rtl:rounded-r rtl:rounded-l-none border-gray-20 border-r rtl:border-l rtl:border-r-0',
112112
{
113113
'text-primary dark:text-primary-dark': canScrollLeft,
114114
'text-gray-30': !canScrollLeft,
@@ -120,7 +120,7 @@ export function Navigation({
120120
onClick={handleScrollRight}
121121
aria-label="Scroll right"
122122
className={cn(
123-
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-e rtl:rotate-180',
123+
'bg-secondary-button dark:bg-secondary-button-dark h-8 px-2 rounded-e',
124124
{
125125
'text-primary dark:text-primary-dark': canScrollRight,
126126
'text-gray-30': !canScrollRight,

src/components/MDX/MDXComponents.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {finishedTranslations} from 'utils/finishedTranslations';
3737

3838
import ErrorDecoder from './ErrorDecoder';
3939
import {IconCanary} from '../Icon/IconCanary';
40+
import {IconExperimental} from 'components/Icon/IconExperimental';
4041

4142
function CodeStep({children, step}: {children: any; step: number}) {
4243
return (
@@ -130,7 +131,7 @@ const ExperimentalBadge = ({title}: {title: string}) => (
130131
className={
131132
'text-base font-display px-1 py-0.5 font-bold bg-gray-10 dark:bg-gray-60 text-gray-60 dark:text-gray-10 rounded'
132133
}>
133-
<IconCanary
134+
<IconExperimental
134135
size="s"
135136
className={'inline me-1 mb-0.5 text-sm text-gray-60 dark:text-gray-10'}
136137
/>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*/
4+
5+
import * as React from 'react';
6+
import {IconClose} from '../../Icon/IconClose';
7+
export interface ClearButtonProps {
8+
onClear: () => void;
9+
}
10+
11+
export function ClearButton({onClear}: ClearButtonProps) {
12+
return (
13+
<button
14+
className="text-sm text-primary dark:text-primary-dark inline-flex items-center hover:text-link duration-100 ease-in transition mx-1"
15+
onClick={onClear}
16+
title="Clear all edits and reload sandbox"
17+
type="button">
18+
<IconClose className="inline mx-1 relative" />
19+
<span className="hidden md:block">Clear</span>
20+
</button>
21+
);
22+
}

src/components/MDX/Sandpack/NavigationBar.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
useSandpackNavigation,
1818
} from '@codesandbox/sandpack-react/unstyled';
1919
import {OpenInCodeSandboxButton} from './OpenInCodeSandboxButton';
20-
import {ResetButton} from './ResetButton';
20+
import {ReloadButton} from './ReloadButton';
21+
import {ClearButton} from './ClearButton';
2122
import {DownloadButton} from './DownloadButton';
2223
import {IconChevron} from '../../Icon/IconChevron';
2324
import {Listbox} from '@headlessui/react';
@@ -95,21 +96,21 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
9596
// Note: in a real useEvent, onContainerResize would be omitted.
9697
}, [isMultiFile, onContainerResize]);
9798

98-
const handleReset = () => {
99+
const handleClear = () => {
99100
/**
100101
* resetAllFiles must come first, otherwise
101102
* the previous content will appear for a second
102103
* when the iframe loads.
103104
*
104105
* Plus, it should only prompt if there's any file changes
105106
*/
106-
if (
107-
sandpack.editorState === 'dirty' &&
108-
confirm('Reset all your edits too?')
109-
) {
107+
if (sandpack.editorState === 'dirty' && confirm('Clear all your edits?')) {
110108
sandpack.resetAllFiles();
111109
}
110+
refresh();
111+
};
112112

113+
const handleReload = () => {
113114
refresh();
114115
};
115116

@@ -188,7 +189,8 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
188189
className="px-3 flex items-center justify-end text-start"
189190
translate="yes">
190191
<DownloadButton providedFiles={providedFiles} />
191-
<ResetButton onReset={handleReset} />
192+
<ReloadButton onReload={handleReload} />
193+
<ClearButton onClear={handleClear} />
192194
<OpenInCodeSandboxButton />
193195
{activeFile.endsWith('.tsx') && (
194196
<OpenInTypeScriptPlaygroundButton
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*/
4+
5+
import * as React from 'react';
6+
import {IconRestart} from '../../Icon/IconRestart';
7+
export interface ReloadButtonProps {
8+
onReload: () => void;
9+
}
10+
11+
export function ReloadButton({onReload}: ReloadButtonProps) {
12+
return (
13+
<button
14+
className="text-sm text-primary dark:text-primary-dark inline-flex items-center hover:text-link duration-100 ease-in transition mx-1"
15+
onClick={onReload}
16+
title="Keep your edits and reload sandbox"
17+
type="button">
18+
<<<<<<< HEAD:src/components/MDX/Sandpack/ResetButton.tsx
19+
<IconRestart className="inline mx-1 relative" /> 重置
20+
=======
21+
<IconRestart className="inline mx-1 relative" />
22+
<span className="hidden md:block">Reload</span>
23+
>>>>>>> a5181c291f01896735b65772f156cfde34df20ee:src/components/MDX/Sandpack/ReloadButton.tsx
24+
</button>
25+
);
26+
}

src/components/MDX/Sandpack/ResetButton.tsx

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

0 commit comments

Comments
 (0)