Skip to content

Commit d307b8a

Browse files
authored
add quick search with inline results to the home page (#2317)
1 parent 0f50195 commit d307b8a

File tree

12 files changed

+597
-133
lines changed

12 files changed

+597
-133
lines changed

components/CompatibilityTags.tsx

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { View } from 'react-native';
22

3-
import { A } from '~/common/styleguide';
3+
import { A, useLayout } from '~/common/styleguide';
44
import { type LibraryType } from '~/types';
55
import tw from '~/util/tailwind';
66

@@ -11,9 +11,12 @@ import Tooltip from './Tooltip';
1111

1212
type Props = {
1313
library: LibraryType;
14+
small?: boolean;
1415
};
1516

16-
export default function CompatibilityTags({ library }: Props) {
17+
export default function CompatibilityTags({ library, small }: Props) {
18+
const { isSmallScreen } = useLayout();
19+
1720
const platforms = [
1821
library.android ? 'Android' : null,
1922
library.ios ? 'iOS' : null,
@@ -25,63 +28,67 @@ export default function CompatibilityTags({ library }: Props) {
2528
].filter(Boolean);
2629

2730
return (
28-
<View style={tw`flex-row flex-wrap items-center gap-1.5`}>
31+
<View style={tw`max-w-full flex-row flex-wrap items-center gap-1.5`}>
2932
{library.dev ? (
3033
<Tag
3134
label="Development Tool"
3235
tagStyle={tw`border-[#d9c8fa] bg-[#ece3fc] dark:border-[#3d2861] dark:bg-[#261a3d]`}
3336
icon={null}
37+
small={small}
3438
/>
3539
) : null}
3640
{library.template ? (
3741
<Tag
3842
label="Template"
3943
tagStyle={tw`border-[#f5c6e8] bg-[#fce1f5] dark:border-[#52213e] dark:bg-[#37172e]`}
4044
icon={null}
45+
small={small}
4146
/>
4247
) : null}
43-
{!library.dev && !library.template && <NewArchitectureTag library={library} />}
48+
{!library.dev && !library.template && <NewArchitectureTag library={library} small={small} />}
4449
{platforms.map(platform =>
4550
platform ? (
4651
<Tag
4752
label={platform}
4853
key={`${platform}-platform`}
4954
tagStyle={tw`border-palette-gray2 bg-palette-gray1 dark:border-default dark:bg-dark`}
55+
small={small}
5056
/>
5157
) : null
5258
)}
53-
{(library.expoGo ?? library.fireos ?? library.vegaos ?? library.horizon) && (
54-
<Tooltip
55-
side="bottom"
56-
trigger={
57-
<View
58-
style={tw`cursor-pointer items-center justify-center rounded-full`}
59-
role="button"
60-
aria-label="Additional information">
61-
<Info style={tw`text-icon`} />
62-
</View>
63-
}>
64-
Additional information
65-
<br />
66-
<ul style={tw`m-0 pl-3.5`}>
67-
{library.expoGo && <li>Works with Expo Go</li>}
68-
{library.fireos && <li>Works with Fire OS</li>}
69-
{library.horizon && <li>Works with Meta Horizon OS</li>}
70-
{library.vegaos && typeof library.vegaos === 'boolean' && <li>Works with Vega OS</li>}
71-
{library.vegaos && typeof library.vegaos === 'string' && (
72-
<li>
73-
Works with Vega OS
74-
<br />
75-
<A
76-
href={`https://www.npmjs.com/package/${library.vegaos}`}
77-
style={tw`text-xs font-light text-white`}>
78-
(via dedicated support package)
79-
</A>
80-
</li>
81-
)}
82-
</ul>
83-
</Tooltip>
84-
)}
59+
{!(small && isSmallScreen) &&
60+
(library.expoGo ?? library.fireos ?? library.vegaos ?? library.horizon) && (
61+
<Tooltip
62+
side="bottom"
63+
trigger={
64+
<View
65+
style={tw`cursor-pointer items-center justify-center rounded-full`}
66+
role="button"
67+
aria-label="Additional information">
68+
<Info style={tw`text-icon`} />
69+
</View>
70+
}>
71+
Additional information
72+
<br />
73+
<ul style={tw`m-0 pl-3.5`}>
74+
{library.expoGo && <li>Works with Expo Go</li>}
75+
{library.fireos && <li>Works with Fire OS</li>}
76+
{library.horizon && <li>Works with Meta Horizon OS</li>}
77+
{library.vegaos && typeof library.vegaos === 'boolean' && <li>Works with Vega OS</li>}
78+
{library.vegaos && typeof library.vegaos === 'string' && (
79+
<li>
80+
Works with Vega OS
81+
<br />
82+
<A
83+
href={`https://www.npmjs.com/package/${library.vegaos}`}
84+
style={tw`text-xs font-light text-white`}>
85+
(via dedicated support package)
86+
</A>
87+
</li>
88+
)}
89+
</ul>
90+
</Tooltip>
91+
)}
8592
</View>
8693
);
8794
}

components/Icons/index.tsx

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,23 +1251,118 @@ export function FundingGitHub({ width = 24, height = 24, style }: IconProps) {
12511251
export function RSS({ width = 24, height = 24, style }: IconProps) {
12521252
return (
12531253
<Svg width={width} height={height} viewBox="0 0 256 256" style={style}>
1254-
<path
1254+
<Path
12551255
d="M64,40A152,152,0,0,1,216,192"
12561256
fill="none"
12571257
stroke="currentColor"
12581258
strokeLinecap="round"
12591259
strokeLinejoin="round"
12601260
strokeWidth="24"
12611261
/>
1262-
<path
1262+
<Path
12631263
d="M64,112a80,80,0,0,1,80,80"
12641264
fill="none"
12651265
stroke="currentColor"
12661266
strokeLinecap="round"
12671267
strokeLinejoin="round"
12681268
strokeWidth="20"
12691269
/>
1270-
<circle cx="68" cy="188" r="12" fill="currentColor" />
1270+
<Circle cx="68" cy="188" r="12" fill="currentColor" />
1271+
</Svg>
1272+
);
1273+
}
1274+
1275+
export function Spinner({ width = 24, height = 24, style }: IconProps) {
1276+
return (
1277+
<Svg width={width} height={height} viewBox="0 0 256 256" style={style} id="spinner">
1278+
<Line
1279+
x1="128"
1280+
y1="32"
1281+
x2="128"
1282+
y2="64"
1283+
fill="none"
1284+
stroke="currentColor"
1285+
strokeLinecap="round"
1286+
strokeLinejoin="round"
1287+
strokeWidth="16"
1288+
/>
1289+
<Line
1290+
x1="195.88"
1291+
y1="60.12"
1292+
x2="173.25"
1293+
y2="82.75"
1294+
fill="none"
1295+
stroke="currentColor"
1296+
strokeLinecap="round"
1297+
strokeLinejoin="round"
1298+
strokeWidth="16"
1299+
/>
1300+
<Line
1301+
x1="224"
1302+
y1="128"
1303+
x2="192"
1304+
y2="128"
1305+
fill="none"
1306+
stroke="currentColor"
1307+
strokeLinecap="round"
1308+
strokeLinejoin="round"
1309+
strokeWidth="16"
1310+
/>
1311+
<Line
1312+
x1="195.88"
1313+
y1="195.88"
1314+
x2="173.25"
1315+
y2="173.25"
1316+
fill="none"
1317+
stroke="currentColor"
1318+
strokeLinecap="round"
1319+
strokeLinejoin="round"
1320+
strokeWidth="16"
1321+
/>
1322+
<Line
1323+
x1="128"
1324+
y1="224"
1325+
x2="128"
1326+
y2="192"
1327+
fill="none"
1328+
stroke="currentColor"
1329+
strokeLinecap="round"
1330+
strokeLinejoin="round"
1331+
strokeWidth="16"
1332+
/>
1333+
<Line
1334+
x1="60.12"
1335+
y1="195.88"
1336+
x2="82.75"
1337+
y2="173.25"
1338+
fill="none"
1339+
stroke="currentColor"
1340+
strokeLinecap="round"
1341+
strokeLinejoin="round"
1342+
strokeWidth="16"
1343+
/>
1344+
<Line
1345+
x1="32"
1346+
y1="128"
1347+
x2="64"
1348+
y2="128"
1349+
fill="none"
1350+
stroke="currentColor"
1351+
strokeLinecap="round"
1352+
strokeLinejoin="round"
1353+
strokeWidth="16"
1354+
/>
1355+
<Line
1356+
x1="60.12"
1357+
y1="60.12"
1358+
x2="82.75"
1359+
y2="82.75"
1360+
fill="none"
1361+
stroke="currentColor"
1362+
strokeLinecap="round"
1363+
strokeLinejoin="round"
1364+
strokeWidth="16"
1365+
/>
12711366
</Svg>
12721367
);
12731368
}

components/Library/LibraryDescription.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as emoji from 'node-emoji';
22
import { Linkify } from 'react-easy-linkify';
3+
import { type StyleProp } from 'react-native';
4+
import { type Style } from 'twrnc';
35

46
import { A, Caption, Headline } from '~/common/styleguide';
57
import { type LibraryType } from '~/types';
@@ -8,11 +10,12 @@ import tw from '~/util/tailwind';
810
type Props = {
911
github: LibraryType['github'];
1012
maxLines?: number;
13+
style?: StyleProp<Style>;
1114
};
1215

13-
export default function LibraryDescription({ github, maxLines }: Props) {
16+
export default function LibraryDescription({ github, maxLines, style }: Props) {
1417
return github.description && github.description.length > 0 ? (
15-
<Headline numberOfLines={maxLines} style={tw`text-base font-light leading-snug`}>
18+
<Headline numberOfLines={maxLines} style={[tw`text-base font-light leading-snug`, style]}>
1619
<Linkify
1720
options={{
1821
linkWrapper: ({ children, ...rest }) => <A {...rest}>{children}</A>,
@@ -21,7 +24,8 @@ export default function LibraryDescription({ github, maxLines }: Props) {
2124
</Linkify>
2225
</Headline>
2326
) : (
24-
<Caption style={tw`text-base font-light leading-snug text-palette-gray4 dark:text-secondary`}>
27+
<Caption
28+
style={[tw`text-base font-light leading-snug text-palette-gray4 dark:text-secondary`, style]}>
2529
The package does not have a description defined.
2630
</Caption>
2731
);

components/Library/NewArchitectureTag.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import tw from '~/util/tailwind';
1111

1212
type Props = {
1313
library: LibraryType;
14+
small?: boolean;
1415
};
1516

16-
export function NewArchitectureTag({ library }: Props) {
17+
export function NewArchitectureTag({ library, small = false }: Props) {
1718
const status = getNewArchSupportStatus(library);
1819
const icon = getTagIcon(status);
1920

@@ -38,6 +39,7 @@ export function NewArchitectureTag({ library }: Props) {
3839
<View>
3940
<Tooltip
4041
side="bottom"
42+
sideOffset={small ? 0 : undefined}
4143
trigger={
4244
<View>
4345
<A href="https://reactnative.dev/architecture/overview">
@@ -49,6 +51,7 @@ export function NewArchitectureTag({ library }: Props) {
4951
}
5052
icon={icon}
5153
tagStyle={getTagColor(status)}
54+
small={small}
5255
/>
5356
</A>
5457
</View>
@@ -70,7 +73,7 @@ function getTagColor(status: NewArchSupportStatus) {
7073
switch (status) {
7174
case NewArchSupportStatus.NewArchOnly:
7275
case NewArchSupportStatus.Supported:
73-
return tw`border-[#d4ebfa] bg-[#edf6fc] dark:border-[#203b4d] dark:bg-[#142733]`;
76+
return tw`border-[#c3e3f7] bg-[#edf6fc] dark:border-[#203b4d] dark:bg-[#142733]`;
7477
case NewArchSupportStatus.Unsupported:
7578
return tw`border-[#faebaf] bg-[#fffae8] dark:border-[#3d3206] dark:bg-[#292005]`;
7679
default:

components/Navigation.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ export default function Navigation({
3030
{header ?? (
3131
<View
3232
style={[
33-
tw`overflow-hidden bg-palette-gray6 py-10 dark:bg-dark`,
33+
tw`relative z-10 bg-palette-gray6 py-10 dark:bg-dark`,
3434
isSmallScreen && tw`py-6`,
3535
style,
3636
]}>
37-
<Logo
38-
width={580}
39-
height={520}
40-
style={tw`absolute left-1/2 top-[-76px] ml-[-280px] text-palette-gray5 opacity-15 dark:text-palette-gray7`}
41-
/>
37+
<View style={tw`absolute inset-0 overflow-hidden`}>
38+
<Logo
39+
width={580}
40+
height={520}
41+
style={tw`absolute left-1/2 top-[-76px] ml-[-280px] text-palette-gray5 opacity-15 dark:text-palette-gray7`}
42+
/>
43+
</View>
4244
<H1
4345
style={[
4446
tw`px-5 text-center text-[42px] leading-[54px] text-white`,

0 commit comments

Comments
 (0)