Skip to content

Commit af6355e

Browse files
committed
Add React Spectrum v3 link
1 parent 7d0ddf8 commit af6355e

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import {divider} from './SearchMenu';
22
import {Key, Separator as RACSeparator} from 'react-aria-components';
3+
import LinkOutIcon from '../../../@react-spectrum/s2/ui-icons/LinkOut';
34
import React from 'react';
45
import {SelectableCollectionContext} from '../../../react-aria-components/src/RSPContexts';
56
import {style} from '@react-spectrum/s2/style' with { type: 'macro' };
67
import {Tag, TagGroup} from '@react-spectrum/s2';
78

89
interface TagItem {
910
id: string,
10-
name: string
11+
name: string,
12+
href?: string
1113
}
1214

1315
interface SearchTagGroupsProps {
@@ -77,8 +79,13 @@ export function SearchTagGroups({
7779
items={resourceTags}
7880
UNSAFE_style={isMobile ? {whiteSpace: 'nowrap'} : undefined}>
7981
{(tag) => (
80-
<Tag key={tag.id} id={tag.id}>
82+
<Tag key={tag.id} id={tag.id} href={tag.href} target="_blank">
8183
{tag.name}
84+
{tag.href &&
85+
<LinkOutIcon
86+
aria-label="(opens in a new tab)"
87+
className={style({'--iconPrimary': {type: 'fill', value: 'currentColor'}, marginStart: 8, flexShrink: 0})} />
88+
}
8289
</Tag>
8390
)}
8491
</TagGroup>

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

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

33
import {Content, Heading, IllustratedMessage} from '@react-spectrum/s2';
4-
import {getLibraryFromPage} from './library';
4+
import {getBaseUrl} from './pageUtils';
55
// @ts-ignore
6+
import {getLibraryFromPage} from './library';
67
import {iconList, useIconFilter} from './IconSearchView';
78
import {Key} from 'react-aria-components';
9+
810
import {type Library, TAB_DEFS} from './constants';
9-
// eslint-disable-next-line monorepo/no-internal-import
10-
import NoSearchResults from '@react-spectrum/s2/illustrations/linear/NoSearchResults';
1111
// @ts-ignore
12+
import NoSearchResults from '@react-spectrum/s2/illustrations/linear/NoSearchResults';
1213
import {Page} from '@parcel/rsc';
1314
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
1415
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
@@ -37,7 +38,8 @@ export interface Section {
3738

3839
export interface Tag {
3940
id: string,
40-
name: string
41+
name: string,
42+
href?: string
4143
}
4244

4345
/**
@@ -349,7 +351,7 @@ export function getOrderedLibraries(currentPage: Page) {
349351

350352
export function getResourceTags(library: Library): Tag[] {
351353
if (library === 'react-spectrum') {
352-
return [{id: 'icons', name: 'Icons'}];
354+
return [{id: 'icons', name: 'Icons'}, {id: 'v3', name: 'React Spectrum v3', href: getBaseUrl('s2') + '/v3/getting-started.html'}];
353355
}
354356
return [];
355357
}

0 commit comments

Comments
 (0)