diff --git a/src/screens/Search/components/AutocompleteResults.tsx b/src/screens/Search/components/AutocompleteResults.tsx index 2824ccc1ba..cfdb6b4821 100644 --- a/src/screens/Search/components/AutocompleteResults.tsx +++ b/src/screens/Search/components/AutocompleteResults.tsx @@ -4,12 +4,11 @@ import {type AppBskyActorDefs} from '@atproto/api' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' -import {isNative} from '#/platform/detection' import {useModerationOpts} from '#/state/preferences/moderation-opts' -import {SearchLinkCard} from '#/view/shell/desktop/Search' import {SearchProfileCard} from '#/screens/Search/components/SearchProfileCard' -import {atoms as a, native} from '#/alf' +import {atoms as a} from '#/alf' import * as Layout from '#/components/Layout' +import {SearchLinkCard} from './SearchLinkCard' let AutocompleteResults = ({ isAutocompleteFetching, @@ -43,12 +42,8 @@ let AutocompleteResults = ({ keyboardDismissMode="on-drag"> {autocompleteData?.map(item => ( diff --git a/src/screens/Search/components/SearchLinkCard.native.tsx b/src/screens/Search/components/SearchLinkCard.native.tsx new file mode 100644 index 0000000000..613bfef978 --- /dev/null +++ b/src/screens/Search/components/SearchLinkCard.native.tsx @@ -0,0 +1,42 @@ +import {type StyleProp, View, type ViewStyle} from 'react-native' + +import {atoms as a, useTheme} from '#/alf' +import {Button} from '#/components/Button' +import {type LinkProps} from '#/components/Link' +import {Text} from '#/components/Typography' + +export function SearchLinkCard({ + label, + onPress, + style, +}: { + label: string + /** + * @platform web + */ + to: LinkProps['to'] + /** + * @platform native + */ + onPress: () => void + style?: StyleProp +}) { + const t = useTheme() + + return ( + + ) +} diff --git a/src/screens/Search/components/SearchLinkCard.tsx b/src/screens/Search/components/SearchLinkCard.tsx new file mode 100644 index 0000000000..8e5695b4b7 --- /dev/null +++ b/src/screens/Search/components/SearchLinkCard.tsx @@ -0,0 +1,42 @@ +import {type StyleProp, View, type ViewStyle} from 'react-native' + +import {atoms as a, useTheme} from '#/alf' +import {Link, type LinkProps} from '#/components/Link' +import {Text} from '#/components/Typography' + +export function SearchLinkCard({ + label, + to, + style, +}: { + label: string + /** + * @platform web + */ + to: LinkProps['to'] + /** + * @platform native + */ + onPress: () => void + style?: StyleProp +}) { + const t = useTheme() + + return ( + + {({focused, hovered, pressed}) => ( + + {label} + + )} + + ) +} diff --git a/src/view/shell/desktop/Search.tsx b/src/view/shell/desktop/Search.tsx index 93d753cd05..1f7b88d7f2 100644 --- a/src/view/shell/desktop/Search.tsx +++ b/src/view/shell/desktop/Search.tsx @@ -1,4 +1,4 @@ -import {memo, useDeferredValue, useRef, useState} from 'react' +import {useDeferredValue, useRef, useState} from 'react' import { ActivityIndicator, type StyleProp, @@ -9,7 +9,6 @@ import { import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {StackActions, useNavigation} from '@react-navigation/native' -import type React from 'react' import {type NavigationProp} from '#/lib/routes/types' import {useModerationOpts} from '#/state/preferences/moderation-opts' @@ -21,7 +20,7 @@ import {MagnifyingGlass2_Stroke2_Corner0_Rounded as SearchIcon} from '#/componen import {Link, type LinkProps} from '#/components/Link' import {Text} from '#/components/Typography' -let SearchLinkCard = ({ +function SearchLinkCard({ label, to, style, @@ -29,7 +28,7 @@ let SearchLinkCard = ({ label: string to: LinkProps['to'] style?: StyleProp -}): React.ReactNode => { +}) { const t = useTheme() return ( @@ -50,8 +49,6 @@ let SearchLinkCard = ({ ) } -SearchLinkCard = memo(SearchLinkCard) -export {SearchLinkCard} export function DesktopSearch() { const {_} = useLingui()