Skip to content

Commit 0e5dca9

Browse files
merging all conflicts
2 parents 75344aa + a5181c2 commit 0e5dca9

34 files changed

+1587
-870
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/Layout/HomeContent.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,7 @@ function CommunityGallery() {
797797
}, []);
798798

799799
return (
800-
<div
801-
ref={ref}
802-
className="relative flex overflow-x-hidden overflow-y-visible w-auto">
800+
<div ref={ref} className="relative flex overflow-x-clip w-auto">
803801
<div
804802
className="w-full py-12 lg:py-20 whitespace-nowrap flex flex-row animate-marquee lg:animate-large-marquee"
805803
style={{
@@ -826,21 +824,26 @@ const CommunityImages = memo(function CommunityImages({isLazy}) {
826824
<div
827825
key={i}
828826
className={cn(
829-
`group flex justify-center px-5 min-w-[50%] lg:min-w-[25%] rounded-2xl relative`
827+
`group flex justify-center px-5 min-w-[50%] lg:min-w-[25%] rounded-2xl`
830828
)}>
831829
<div
832830
className={cn(
833-
'h-auto relative rounded-2xl overflow-hidden before:-skew-x-12 before:absolute before:inset-0 before:-translate-x-full group-hover:before:animate-[shimmer_1s_forwards] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent transition-all ease-in-out duration-300',
831+
'h-auto rounded-2xl before:rounded-2xl before:absolute before:pointer-events-none before:inset-0 before:transition-opacity before:-z-1 before:shadow-lg lg:before:shadow-2xl before:opacity-0 before:group-hover:opacity-100 transition-transform ease-in-out duration-300',
834832
i % 2 === 0
835-
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl'
836-
: 'group-hover:rotate-1 group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl rotate-[-2deg]'
833+
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110'
834+
: 'group-hover:rotate-1 group-hover:scale-110 rotate-[-2deg]'
837835
)}>
838-
<img
839-
loading={isLazy ? 'lazy' : 'eager'}
840-
src={src}
841-
alt={alt}
842-
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
843-
/>
836+
<div
837+
className={cn(
838+
'overflow-clip relative before:absolute before:inset-0 before:pointer-events-none before:-translate-x-full group-hover:before:animate-[shimmer_1s_forwards] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent transition-transform ease-in-out duration-300'
839+
)}>
840+
<img
841+
loading={isLazy ? 'lazy' : 'eager'}
842+
src={src}
843+
alt={alt}
844+
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
845+
/>
846+
</div>
844847
</div>
845848
</div>
846849
))}

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

src/components/MDX/Sandpack/ResetButton.tsx renamed to src/components/MDX/Sandpack/ReloadButton.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44

55
import * as React from 'react';
66
import {IconRestart} from '../../Icon/IconRestart';
7-
export interface ResetButtonProps {
8-
onReset: () => void;
7+
export interface ReloadButtonProps {
8+
onReload: () => void;
99
}
1010

11-
export function ResetButton({onReset}: ResetButtonProps) {
11+
export function ReloadButton({onReload}: ReloadButtonProps) {
1212
return (
1313
<button
1414
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={onReset}
16-
title="Reset Sandbox"
15+
onClick={onReload}
16+
title="Keep your edits and reload sandbox"
1717
type="button">
18-
<IconRestart className="inline mx-1 relative" /> Reset
18+
<IconRestart className="inline mx-1 relative" />
19+
<span className="hidden md:block">Reload</span>
1920
</button>
2021
);
2122
}

0 commit comments

Comments
 (0)