Skip to content

Commit 2483eb0

Browse files
committed
fix mobile header icon and library label
1 parent cb516ed commit 2483eb0

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

packages/dev/s2-docs/src/Layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export function Layout(props: PageProps & {children: ReactElement<any>}) {
117117
<TitleResizer />
118118
<Header pages={pages} currentPage={currentPage} />
119119
<MobileHeader
120+
currentPage={currentPage}
120121
toc={<MobileToc key="toc" toc={currentPage.tableOfContents ?? []} />}
121122
nav={<MobileNav key="nav" pages={pages} currentPage={currentPage} />} />
122123
<div className={style({display: 'flex', width: 'full', marginTop: 12})}>

packages/dev/s2-docs/src/MobileHeader.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use client';
22

33
import {ActionButton, CloseButton, DialogTrigger} from '@react-spectrum/s2';
4-
import {AdobeLogo} from './AdobeLogo';
54
import {composeRenderProps, OverlayTriggerStateContext, Dialog as RACDialog, DialogProps as RACDialogProps} from 'react-aria-components';
5+
import {getCurrentLibrary, TAB_DEFS} from './SearchMenu';
66
import {keyframes} from '../../../@react-spectrum/s2/style/style-macro' with {type: 'macro'};
77
import MenuHamburger from '@react-spectrum/s2/icons/MenuHamburger';
88
import {Modal} from '../../../@react-spectrum/s2/src/Modal';
@@ -107,7 +107,7 @@ const MobileCustomDialog = forwardRef<HTMLDivElement, MobileDialogProps>(functio
107107
);
108108
});
109109

110-
export function MobileHeader({toc, nav}) {
110+
export function MobileHeader({toc, nav, currentPage}) {
111111
let ref = useRef<HTMLDivElement | null>(null);
112112

113113
useEffect(() => {
@@ -129,6 +129,9 @@ export function MobileHeader({toc, nav}) {
129129
}
130130
}, []);
131131

132+
let currentLibrary = getCurrentLibrary(currentPage);
133+
let icon = TAB_DEFS[currentLibrary].icon;
134+
132135
return (
133136
<div
134137
ref={ref}
@@ -172,7 +175,7 @@ export function MobileHeader({toc, nav}) {
172175
alignItems: 'center',
173176
flexGrow: 1
174177
})}>
175-
<AdobeLogo />
178+
{icon}
176179
<h2
177180
className={style({
178181
font: 'heading-sm',
@@ -184,7 +187,7 @@ export function MobileHeader({toc, nav}) {
184187
animationTimeline: 'scroll()',
185188
animationRange
186189
} as CSSProperties}>
187-
React Aria
190+
{TAB_DEFS[currentLibrary].label}
188191
</h2>
189192
</div>
190193
<div

packages/dev/s2-docs/src/client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let updateRoot = hydrate({
1212
});
1313

1414
// A very simple router. When we navigate, we'll fetch a new RSC payload from the server,
15-
// and in a React transition, stream in the new page. Once complete, we'll pushState to
15+
// and in a React transition, stream in the new page. Once complete, we'll pushState to
1616
// update the URL in the browser.
1717
async function navigate(pathname: string, push = false) {
1818
let res = fetchRSC<ReactElement>(pathname.replace('.html', '.rsc'));

packages/dev/s2-docs/src/icons/ReactAriaLogo.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import React from 'react';
1+
import React, {useId} from 'react';
22
import {style} from '@react-spectrum/s2/style' with { type: 'macro' };
33

44
export const ReactAriaLogo = () => {
5+
const clipPathId = `react-aria-logo-clip-${useId()}`;
6+
57
return (
68
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 160" className={style({margin: 0, height: 40, width: 40})}>
79
<defs>
8-
<clipPath id="a">
10+
<clipPath id={clipPathId}>
911
<path
1012
d="M80 136c30.93 0 56-25.07 56-56s-25.07-56-56-56-56 25.07-56 56 25.07 56 56 56Zm8.48-86.3c0 4.69-3.8 8.48-8.48 8.48s-8.48-3.8-8.48-8.48 3.8-8.48 8.48-8.48 8.48 3.8 8.48 8.48ZM51.09 61.78c.52-1.8 2.39-2.85 4.2-2.33a89.865 89.865 0 0 0 48.82.17l.64-.18c1.81-.5 3.68.55 4.18 2.36a3.39 3.39 0 0 1-2.36 4.18l-.64.18a97.139 97.139 0 0 1-15.51 2.98c-1.03.11-1.82.97-1.82 2.01v14.89c0 .18.03.37.08.55 1.37 4.83 2.94 10.39 4.32 15.27.98 3.46 1.86 6.58 2.49 8.85.32 1.14.58 2.06.76 2.71l.04.15c.13.48.27.97.31 1.16a3.38 3.38 0 0 1-2.66 3.99 3.38 3.38 0 0 1-3.99-2.66c.02.09 0 .04-.08-.27-.04-.13-.09-.31-.15-.54-.18-.65-.44-1.57-.76-2.7-.64-2.27-1.52-5.39-2.49-8.85l-3.74-13.21a1.992 1.992 0 0 0-1.92-1.45h-1.6c-.89 0-1.68.59-1.92 1.45-1.22 4.3-2.55 9.01-3.74 13.21-.98 3.46-1.85 6.58-2.49 8.85-.32 1.13-.58 2.06-.76 2.7-.06.23-.11.41-.15.54-.09.31-.1.36-.08.27a3.39 3.39 0 1 1-6.65-1.33c.04-.18.18-.68.31-1.16l.04-.15c.18-.65.44-1.58.76-2.71.64-2.27 1.52-5.39 2.49-8.85 1.38-4.88 2.95-10.44 4.32-15.27.05-.18.08-.36.08-.55V71.16c0-1.04-.79-1.9-1.82-2.01a96.504 96.504 0 0 1-16.17-3.17 3.395 3.395 0 0 1-2.33-4.2Z"
1113
style={{
@@ -22,7 +24,7 @@ export const ReactAriaLogo = () => {
2224
}} />
2325
<g
2426
style={{
25-
clipPath: 'url(#a)'
27+
clipPath: `url(#${clipPathId})`
2628
}}>
2729
<path
2830
d="M15.79 17.64H147v126.14H15.79z"

0 commit comments

Comments
 (0)