Skip to content

Commit cd3c588

Browse files
authored
docs: Homepage updates and fixes (#9344)
* Replace process.env.DOCS_ENV in build * Fix Image objectFit and objectPosition styles with picture wrapper * A few tailwind example app fixes * Fix copying folded code * Fix header flickering during toast view transition * Preload card images when hovering tag in search menu * Merge internationalized into React Aria in search * Update home page headers * Update logo * Fix DOCS_ENV in development * Fix typescript * lint * Fix internationalized nav * Fix skeleton showing when clicking links on home page * Order guides above interactions in nav * Make home page header line up with other pages * Fix some tailwind css conflicts between home page and other pages * Adjust size of logos in mobile search menu * Fix library in AI prompt * Sort getting started to the top * Slight improvements * Re-title internationalized intro pages * Updates for testing * Improve background on mobile * Fix focus ring on component links * Update logo and favicon * Delay pre-fetching until after view transitions * Fix colors * Update video * Update react aria open graph image
1 parent 3ad9c26 commit cd3c588

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1564
-1142
lines changed

packages/@react-spectrum/s2/src/Avatar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';
1717
import {filterDOMProps} from '@react-aria/utils';
1818
import {getAllowedOverrides, StylesPropWithoutWidth, UnsafeStyles} from './style-utils' with {type: 'macro'};
1919
import {Image} from './Image';
20+
import {isDocsEnv} from './macros' with {type: 'macro'};
2021
import {style} from '../style' with { type: 'macro' };
2122
import {useDOMRef} from '@react-spectrum/utils';
2223
import {useSpectrumContextProps} from './useSpectrumContextProps';
@@ -77,7 +78,7 @@ export const Avatar = forwardRef(function Avatar(props: AvatarProps, ref: DOMRef
7778
const domProps = filterDOMProps(otherProps);
7879

7980
// In the docs build, we need to be able to simulate font scaling.
80-
let remSize = process.env.DOCS_ENV ? `calc(${size / 16} * var(--rem, 1rem))` : `${size / 16}rem`;
81+
let remSize = isDocsEnv() ? `calc(${size / 16} * var(--rem, 1rem))` : `${size / 16}rem`;
8182
let isLarge = size >= 64;
8283
return (
8384
<Image

packages/@react-spectrum/s2/src/Image.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export const Image = forwardRef(function Image(props: ImageProps, domRef: Forwar
310310

311311
if (Array.isArray(srcProp)) {
312312
img = (
313-
<picture>
313+
<picture className={style({objectFit: 'inherit', objectPosition: 'inherit'})}>
314314
{srcProp.map((source, i) => {
315315
let {colorScheme: sourceColorScheme, ...sourceProps} = source;
316316
if (sourceColorScheme) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright 2025 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
export function isDocsEnv(): boolean {
14+
return !!process.env.DOCS_ENV;
15+
}

packages/dev/docs/pages/react-aria/home/ExampleApp.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export function ExampleApp(): React.ReactNode {
209209
</DialogTrigger>
210210
<MenuTrigger>
211211
<TooltipTrigger>
212-
<Button aria-label="Columns" variant="secondary" className="!h-9 shrink-0 p-0 hidden sm:inline-flex">
212+
<Button aria-label="Columns" variant="secondary" className="!w-9 !h-9 shrink-0 p-0 hidden sm:inline-flex">
213213
<SlidersIcon aria-hidden className="block w-5 h-5" />
214214
</Button>
215215
<Tooltip>Columns</Tooltip>
@@ -222,7 +222,7 @@ export function ExampleApp(): React.ReactNode {
222222
</Menu>
223223
</MenuTrigger>
224224
<DialogTrigger>
225-
<Button aria-label="Add plant" variant="secondary" className="!h-9 shrink-0 p-0 col-start-5">
225+
<Button aria-label="Add plant" variant="secondary" className="!w-9 !h-9 shrink-0 p-0 col-start-5">
226226
<PlusIcon aria-hidden className="block w-5 h-5" />
227227
</Button>
228228
<PlantModal>
@@ -506,7 +506,7 @@ function PlantModal(props: ModalOverlayProps) {
506506
// Use position: absolute instead of fixed to avoid
507507
// being clipped to the "inner" viewport in iOS 26
508508
className={({isEntering, isExiting}) => `
509-
absolute top-0 left-0 w-full h-(--page-height) isolate z-20 bg-black/[15%] backdrop-blur-lg
509+
absolute top-0 left-0 w-full h-(--page-height) max-h-[5000px] isolate z-20 bg-black/[15%] backdrop-blur-lg
510510
${isEntering ? 'animate-in fade-in duration-200 ease-out' : ''}
511511
${isExiting ? 'animate-out fade-out duration-200 ease-in' : ''}
512512
`}>

packages/dev/docs/pages/react-aria/home/components.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212
import {ArrowRight} from 'lucide-react';
13+
import {BaseLink} from '@react-spectrum/s2-docs/src/Link';
1314
import React, {ForwardedRef, HTMLAttributes, ReactNode} from 'react';
15+
import {twMerge} from 'tailwind-merge';
1416

1517
export function Window({children, className = '', isBackground = false, toolbar}: {children: ReactNode, className?: string, isBackground?: boolean, toolbar: ReactNode}): ReactNode {
1618
return (
@@ -33,7 +35,7 @@ export function FileTab({children, className = ''}: {children: ReactNode, classN
3335
}
3436

3537
export function AddressBar({children}: {children: ReactNode}): ReactNode {
36-
return <div className="bg-gray-400/40 dark:bg-zinc-500/40 px-5 md:px-10 py-1 ml-20 sm:mx-auto my-2.5 rounded-md text-slate-600 dark:text-slate-300 text-xs">{children}</div>;
38+
return <div className="bg-gray-400/40 dark:bg-zinc-500/40 px-5 md:px-10 py-1 ml-20 flex-1 text-center sm:flex-none sm:mx-auto my-2.5 rounded-md text-slate-600 dark:text-slate-300 text-xs">{children}</div>;
3739
}
3840

3941
export function GradientText({children}: {children: ReactNode}): ReactNode {
@@ -74,7 +76,7 @@ export function Arrow({href, children, textX, x1, x2, points, y, marker = 'marke
7476
? <polyline points={points} {...markerProps} className="stroke-slate-800 dark:stroke-white fill-none" />
7577
: <line x1={x1} y1={y} x2={x2} y2={y} {...markerProps} className="stroke-slate-800 dark:stroke-white" />
7678
}
77-
<a href={href} target="_blank" className="pointer-events-auto outline-hidden rounded-xs focus:outline-blue-600 dark:focus:outline-blue-500 outline-offset-2"><text x={textX} y={y + 3} className="text-xs fill-slate-900 dark:fill-white underline">{children}</text></a>
79+
<a href={href} target="_blank" className="pointer-events-auto outline-hidden rounded-xs outline-0 outline-solid focus-visible:outline-2 focus-visible:outline-black dark:focus-visible:outline-white outline-offset-2"><text x={textX} y={y + 3} className="text-xs fill-slate-900 dark:fill-white underline">{children}</text></a>
7880
</>
7981
);
8082
}
@@ -85,8 +87,8 @@ React.forwardRef((props: HTMLAttributes<HTMLDivElement>, ref: ForwardedRef<HTMLD
8587
return <div ref={ref} className="z-10 pointer-events-none absolute w-10 h-10 rounded-full border border-black/80 bg-black/80 dark:border-white/80 dark:bg-white/80 dark:mix-blend-difference opacity-0 [--hover-opacity:0.15] [--pressed-opacity:0.3] forced-colors:[--hover-opacity:0.5] forced-colors:[--pressed-opacity:1] forced-colors:bg-[Highlight]! forced-colors:mix-blend-normal!" {...props} />;
8688
});
8789

88-
export function LearnMoreLink({href, className}: {href: string, className: string}): ReactNode {
89-
return <a href={href} className={`group inline-block mt-6 mb-12 no-underline text-xl rounded-full px-4 -mx-4 py-1 transition focus-ring active:scale-95 ${className}`}>Learn more<ArrowRight aria-hidden className="inline w-5 h-5 align-middle ml-1 will-change-transform group-hover:translate-x-0.5 transition -mt-1" /></a>;
90+
export function LearnMoreLink({children, href, className}: {children?: string, href: string, className: string}): ReactNode {
91+
return <BaseLink href={href} className={twMerge('group inline-block mt-6 mb-12 no-underline text-xl rounded-full px-4 -mx-4 py-1 transition focus-ring active:scale-95', className)}>{children || 'Learn more'}<ArrowRight aria-hidden className="inline w-5 h-5 align-middle ml-1 will-change-transform group-hover:translate-x-0.5 transition -mt-1" /></BaseLink>;
9092
}
9193

9294
export function Scrollable({children, className = ''}: {children: ReactNode, className?: string}): ReactNode {

0 commit comments

Comments
 (0)