Skip to content

Commit 8827283

Browse files
committed
fix mobile header icon and library label
1 parent 96e5138 commit 8827283

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ export function Layout(props: PageProps & {children: ReactElement<any>}) {
101101
<TitleResizer />
102102
<Header pages={pages} currentPage={currentPage} />
103103
<MobileHeader
104+
currentPage={currentPage}
104105
toc={<MobileToc key="toc" toc={currentPage.tableOfContents ?? []} />}
105-
pages={pages}
106-
currentPage={currentPage} />
106+
pages={pages} />
107107
<div className={style({display: 'flex', width: 'full'})}>
108108
<Nav pages={pages} currentPage={currentPage} />
109109
<main

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use client';
22

33
import {ActionButton, DialogTrigger} from '@react-spectrum/s2';
4-
import {AdobeLogo} from './AdobeLogo';
54
import {keyframes} from '../../../@react-spectrum/s2/style/style-macro' with {type: 'macro'};
65
import MenuHamburger from '@react-spectrum/s2/icons/MenuHamburger';
76
import {Modal} from '../../../@react-spectrum/s2/src/Modal';
87
import React, {CSSProperties, lazy, useEffect, useRef} from 'react';
98
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
9+
import {TAB_DEFS} from './constants';
1010

1111
const MobileSearchMenu = lazy(() => import('./SearchMenu').then(({MobileSearchMenu}) => ({default: MobileSearchMenu})));
1212

@@ -80,6 +80,9 @@ export function MobileHeader({toc, pages, currentPage}) {
8080
}
8181
}, []);
8282

83+
let currentLibrary = getCurrentLibrary(currentPage);
84+
let icon = TAB_DEFS[currentLibrary].icon;
85+
8386
return (
8487
<div
8588
ref={ref}
@@ -123,7 +126,7 @@ export function MobileHeader({toc, pages, currentPage}) {
123126
alignItems: 'center',
124127
flexGrow: 1
125128
})}>
126-
<AdobeLogo />
129+
{icon}
127130
<h2
128131
className={style({
129132
font: 'heading-sm',
@@ -135,7 +138,7 @@ export function MobileHeader({toc, pages, currentPage}) {
135138
animationTimeline: 'scroll()',
136139
animationRange
137140
} as CSSProperties}>
138-
React Aria
141+
{TAB_DEFS[currentLibrary].label}
139142
</h2>
140143
</div>
141144
<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)