Skip to content

Commit 48b0cd1

Browse files
committed
remove broken title resizer code and fix rebase
1 parent 987cff4 commit 48b0cd1

File tree

3 files changed

+17
-98
lines changed

3 files changed

+17
-98
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {PickerItem, Provider} from '@react-spectrum/s2';
1515
import {PropTable} from './PropTable';
1616
import {StateTable} from './StateTable';
1717
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
18-
import {TitleResizer} from './TitleResizer';
1918
import {TypeLink} from './types';
2019
import {VisualExample} from './VisualExample';
2120

@@ -98,11 +97,10 @@ export function Layout(props: PageProps & {children: ReactElement<any>}) {
9897
}
9998
})}>
10099
<div className={style({isolation: 'isolate', width: 'full'})}>
101-
<TitleResizer />
102100
<Header pages={pages} currentPage={currentPage} />
103101
<MobileHeader
104102
currentPage={currentPage}
105-
toc={<MobileToc key="toc" toc={currentPage.tableOfContents ?? []} />}
103+
toc={<MobileToc key="toc" toc={currentPage.tableOfContents ?? []} currentPage={currentPage} />}
106104
pages={pages} />
107105
<div className={style({display: 'flex', width: 'full'})}>
108106
<Nav pages={pages} currentPage={currentPage} />

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

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import {CloseButton, Content, Heading, IllustratedMessage, SearchField, Tab, TabList, TabPanel, Tabs, Tag, TagGroup} from '@react-spectrum/s2';
44
import {ComponentCardItem, ComponentCardView} from './ComponentCardView';
5-
import {composeRenderProps, OverlayTriggerStateContext, Dialog as RACDialog, DialogProps as RACDialogProps} from 'react-aria-components';
65
import {getLibraryFromPage} from './library';
76
import {type Library, TAB_DEFS} from './constants';
87
// eslint-disable-next-line monorepo/no-internal-import
98
import NoSearchResults from '@react-spectrum/s2/illustrations/linear/NoSearchResults';
9+
import {OverlayTriggerStateContext, Dialog as RACDialog, DialogProps as RACDialogProps} from 'react-aria-components';
1010
import type {PageProps} from '@parcel/rsc';
11-
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
11+
import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
1212
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
1313

1414

@@ -55,13 +55,7 @@ const MobileCustomDialog = function MobileCustomDialog(props: MobileDialogProps)
5555
return (
5656
<RACDialog
5757
{...props}
58-
className={dialogStyle({padding})}>
59-
{composeRenderProps(props.children, (children) => (
60-
<OverlayTriggerStateContext.Provider value={null}>
61-
{children}
62-
</OverlayTriggerStateContext.Provider>
63-
))}
64-
</RACDialog>
58+
className={dialogStyle({padding})} />
6559
);
6660
};
6761

@@ -103,7 +97,7 @@ function MobileNav({pages, currentPage}: PageProps) {
10397
});
10498
return sectionArray;
10599
}, [getSectionsForLibrary, selectedLibrary]);
106-
100+
107101

108102
useEffect(() => {
109103
// Auto-select first section initially or when library changes
@@ -168,7 +162,7 @@ function MobileNav({pages, currentPage}: PageProps) {
168162
if (!searchValue.trim()) {
169163
return pages;
170164
}
171-
165+
172166
let searchLower = searchValue.toLowerCase();
173167
return pages.filter(page => {
174168
let pageTitle = title(page).toLowerCase();
@@ -179,9 +173,9 @@ function MobileNav({pages, currentPage}: PageProps) {
179173
let getSectionContent = (sectionName: string, libraryId: string, searchValue: string = ''): ComponentCardItem[] => {
180174
let librarySections = getSectionsForLibrary(libraryId);
181175
let pages = librarySections.get(sectionName) ?? [];
182-
176+
183177
let filteredPages = filterPages(pages, searchValue);
184-
178+
185179
return filteredPages
186180
.sort((a, b) => title(a).localeCompare(title(b)))
187181
.map(page => ({id: page.url.replace(/^\//, ''), name: title(page), href: page.url}));
@@ -209,7 +203,7 @@ function MobileNav({pages, currentPage}: PageProps) {
209203
let getSectionNamesForLibrary = (libraryId: string) => {
210204
let librarySections = getSectionsForLibrary(libraryId);
211205
let sectionArray = [...librarySections.keys()];
212-
206+
213207
// Show 'Components' first
214208
sectionArray.sort((a, b) => {
215209
if (a === 'Components') {
@@ -220,7 +214,7 @@ function MobileNav({pages, currentPage}: PageProps) {
220214
}
221215
return a.localeCompare(b);
222216
});
223-
217+
224218
return sectionArray;
225219
};
226220

@@ -263,10 +257,11 @@ function MobileNav({pages, currentPage}: PageProps) {
263257
scrollContainerRef.current.scrollTo({top: 0, behavior: 'auto'});
264258
}
265259
}, [selectedSection, selectedLibrary]);
260+
let state = useContext(OverlayTriggerStateContext);
266261

267262
return (
268263
<div className={style({minHeight: '100dvh', paddingBottom: 24, boxSizing: 'border-box'})}>
269-
<Tabs
264+
<Tabs
270265
aria-label="Libraries"
271266
density="compact"
272267
selectedKey={selectedLibrary}
@@ -294,16 +289,16 @@ function MobileNav({pages, currentPage}: PageProps) {
294289
ref={headerRef}
295290
className={style({position: 'sticky', zIndex: 1, backgroundColor: 'layer-2'})}
296291
style={{top: tabListHeight}}>
297-
<SearchField
298-
aria-label="Search"
292+
<SearchField
293+
aria-label="Search"
299294
value={searchValue}
300295
onChange={handleSearchChange}
301296
onFocus={handleSearchFocus}
302297
onBlur={handleSearchBlur}
303298
styles={style({marginY: 12})} />
304299
<TagGroup
305-
aria-label="Navigation sections"
306-
selectionMode="single"
300+
aria-label="Navigation sections"
301+
selectionMode="single"
307302
selectedKeys={selectedSection ? [selectedSection] : []}
308303
onSelectionChange={handleTagSelection}
309304
styles={style({margin: 12})}
@@ -313,6 +308,7 @@ function MobileNav({pages, currentPage}: PageProps) {
313308
</div>
314309
<div ref={scrollContainerRef}>
315310
<ComponentCardView
311+
onAction={() => state?.close()}
316312
items={getItemsForSelection(selectedSection, library.id, searchValue)}
317313
ariaLabel="Pages"
318314
size="S"

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

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

0 commit comments

Comments
 (0)