Improved search language select (#7591)
* replace with Menu * new icon for native * hackfix radix dropdown height * fix jsx * reduce language names with lots of variants to what firefox returns from Intl.DisplayNames * more language label simplifications * add collision padding * adjust spacing around and left align title
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M11.293 4.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L12 6.414 8.707 9.707a1 1 0 0 1-1.414-1.414l4-4Zm-4 10a1 1 0 0 1 1.414 0L12 17.586l3.293-3.293a1 1 0 0 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>
|
||||||
|
After Width: | Height: | Size: 363 B |
@@ -50,6 +50,12 @@ export const atoms = {
|
|||||||
overflow_hidden: {
|
overflow_hidden: {
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @platform web
|
||||||
|
*/
|
||||||
|
overflow_auto: web({
|
||||||
|
overflow: 'auto',
|
||||||
|
}),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Width
|
* Width
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ export function Outer({
|
|||||||
<DropdownMenu.Portal>
|
<DropdownMenu.Portal>
|
||||||
<DropdownMenu.Content
|
<DropdownMenu.Content
|
||||||
sideOffset={5}
|
sideOffset={5}
|
||||||
|
collisionPadding={{left: 5, right: 5, bottom: 5}}
|
||||||
loop
|
loop
|
||||||
aria-label="Test"
|
aria-label="Test"
|
||||||
className="dropdown-menu-transform-origin">
|
className="dropdown-menu-transform-origin">
|
||||||
@@ -195,6 +196,7 @@ export function Outer({
|
|||||||
t.name === 'light' ? t.atoms.bg : t.atoms.bg_contrast_25,
|
t.name === 'light' ? t.atoms.bg : t.atoms.bg_contrast_25,
|
||||||
t.atoms.shadow_md,
|
t.atoms.shadow_md,
|
||||||
t.atoms.border_contrast_low,
|
t.atoms.border_contrast_low,
|
||||||
|
a.overflow_auto,
|
||||||
!reduceMotionEnabled && a.zoom_fade_in,
|
!reduceMotionEnabled && a.zoom_fade_in,
|
||||||
style,
|
style,
|
||||||
]}>
|
]}>
|
||||||
@@ -380,9 +382,8 @@ export function Divider() {
|
|||||||
style={flatten([
|
style={flatten([
|
||||||
a.my_xs,
|
a.my_xs,
|
||||||
t.atoms.bg_contrast_100,
|
t.atoms.bg_contrast_100,
|
||||||
{
|
a.flex_shrink_0,
|
||||||
height: 1,
|
{height: 1},
|
||||||
},
|
|
||||||
])}
|
])}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,3 +15,7 @@ export const ChevronTop_Stroke2_Corner0_Rounded = createSinglePathSVG({
|
|||||||
export const ChevronBottom_Stroke2_Corner0_Rounded = createSinglePathSVG({
|
export const ChevronBottom_Stroke2_Corner0_Rounded = createSinglePathSVG({
|
||||||
path: 'M3.293 8.293a1 1 0 0 1 1.414 0L12 15.586l7.293-7.293a1 1 0 1 1 1.414 1.414l-8 8a1 1 0 0 1-1.414 0l-8-8a1 1 0 0 1 0-1.414Z',
|
path: 'M3.293 8.293a1 1 0 0 1 1.414 0L12 15.586l7.293-7.293a1 1 0 1 1 1.414 1.414l-8 8a1 1 0 0 1-1.414 0l-8-8a1 1 0 0 1 0-1.414Z',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export const ChevronTopBottom_Stroke2_Corner0_Rounded = createSinglePathSVG({
|
||||||
|
path: 'M11.293 4.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L12 6.414 8.707 9.707a1 1 0 0 1-1.414-1.414l4-4Zm-4 10a1 1 0 0 1 1.414 0L12 17.586l3.293-3.293a1 1 0 0 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 0-1.414Z',
|
||||||
|
})
|
||||||
|
|||||||
+11
-19
@@ -179,11 +179,7 @@ export const LANGUAGES: Language[] = [
|
|||||||
{code3: 'cho', code2: '', name: 'Choctaw'},
|
{code3: 'cho', code2: '', name: 'Choctaw'},
|
||||||
{code3: 'chp', code2: '', name: 'Chipewyan; Dene Suline'},
|
{code3: 'chp', code2: '', name: 'Chipewyan; Dene Suline'},
|
||||||
{code3: 'chr', code2: '', name: 'Cherokee'},
|
{code3: 'chr', code2: '', name: 'Cherokee'},
|
||||||
{
|
{code3: 'chu', code2: 'cu', name: 'Church Slavic'},
|
||||||
code3: 'chu',
|
|
||||||
code2: 'cu',
|
|
||||||
name: 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic',
|
|
||||||
},
|
|
||||||
{code3: 'chv', code2: 'cv', name: 'Chuvash'},
|
{code3: 'chv', code2: 'cv', name: 'Chuvash'},
|
||||||
{code3: 'chy', code2: '', name: 'Cheyenne'},
|
{code3: 'chy', code2: '', name: 'Cheyenne'},
|
||||||
{code3: 'cmc', code2: '', name: 'Chamic languages'},
|
{code3: 'cmc', code2: '', name: 'Chamic languages'},
|
||||||
@@ -301,13 +297,9 @@ export const LANGUAGES: Language[] = [
|
|||||||
{code3: 'iii', code2: 'ii', name: 'Sichuan Yi; Nuosu'},
|
{code3: 'iii', code2: 'ii', name: 'Sichuan Yi; Nuosu'},
|
||||||
{code3: 'ijo', code2: '', name: 'Ijo languages'},
|
{code3: 'ijo', code2: '', name: 'Ijo languages'},
|
||||||
{code3: 'iku', code2: 'iu', name: 'Inuktitut'},
|
{code3: 'iku', code2: 'iu', name: 'Inuktitut'},
|
||||||
{code3: 'ile', code2: 'ie', name: 'Interlingue; Occidental'},
|
{code3: 'ile', code2: 'ie', name: 'Interlingue'},
|
||||||
{code3: 'ilo', code2: '', name: 'Iloko'},
|
{code3: 'ilo', code2: '', name: 'Iloko'},
|
||||||
{
|
{code3: 'ina', code2: 'ia', name: 'Interlingua'},
|
||||||
code3: 'ina',
|
|
||||||
code2: 'ia',
|
|
||||||
name: 'Interlingua (International Auxiliary Language Association)',
|
|
||||||
},
|
|
||||||
{code3: 'inc', code2: '', name: 'Indic languages'},
|
{code3: 'inc', code2: '', name: 'Indic languages'},
|
||||||
{code3: 'ind', code2: 'id', name: 'Indonesian'},
|
{code3: 'ind', code2: 'id', name: 'Indonesian'},
|
||||||
{code3: 'ine', code2: '', name: 'Indo-European languages'},
|
{code3: 'ine', code2: '', name: 'Indo-European languages'},
|
||||||
@@ -325,7 +317,7 @@ export const LANGUAGES: Language[] = [
|
|||||||
{code3: 'kaa', code2: '', name: 'Kara-Kalpak'},
|
{code3: 'kaa', code2: '', name: 'Kara-Kalpak'},
|
||||||
{code3: 'kab', code2: '', name: 'Kabyle'},
|
{code3: 'kab', code2: '', name: 'Kabyle'},
|
||||||
{code3: 'kac', code2: '', name: 'Kachin; Jingpho'},
|
{code3: 'kac', code2: '', name: 'Kachin; Jingpho'},
|
||||||
{code3: 'kal', code2: 'kl', name: 'Kalaallisut; Greenlandic'},
|
{code3: 'kal', code2: 'kl', name: 'Kalaallisut'},
|
||||||
{code3: 'kam', code2: '', name: 'Kamba'},
|
{code3: 'kam', code2: '', name: 'Kamba'},
|
||||||
{code3: 'kan', code2: 'kn', name: 'Kannada'},
|
{code3: 'kan', code2: 'kn', name: 'Kannada'},
|
||||||
{code3: 'kar', code2: '', name: 'Karen languages'},
|
{code3: 'kar', code2: '', name: 'Karen languages'},
|
||||||
@@ -364,7 +356,7 @@ export const LANGUAGES: Language[] = [
|
|||||||
{code3: 'lat', code2: 'la', name: 'Latin'},
|
{code3: 'lat', code2: 'la', name: 'Latin'},
|
||||||
{code3: 'lav', code2: 'lv', name: 'Latvian'},
|
{code3: 'lav', code2: 'lv', name: 'Latvian'},
|
||||||
{code3: 'lez', code2: '', name: 'Lezghian'},
|
{code3: 'lez', code2: '', name: 'Lezghian'},
|
||||||
{code3: 'lim', code2: 'li', name: 'Limburgan; Limburger; Limburgish'},
|
{code3: 'lim', code2: 'li', name: 'Limburgish'},
|
||||||
{code3: 'lin', code2: 'ln', name: 'Lingala'},
|
{code3: 'lin', code2: 'ln', name: 'Lingala'},
|
||||||
{code3: 'lit', code2: 'lt', name: 'Lithuanian'},
|
{code3: 'lit', code2: 'lt', name: 'Lithuanian'},
|
||||||
{code3: 'lol', code2: '', name: 'Mongo'},
|
{code3: 'lol', code2: '', name: 'Mongo'},
|
||||||
@@ -425,9 +417,9 @@ export const LANGUAGES: Language[] = [
|
|||||||
{code3: 'nai', code2: '', name: 'North American Indian languages'},
|
{code3: 'nai', code2: '', name: 'North American Indian languages'},
|
||||||
{code3: 'nap', code2: '', name: 'Neapolitan'},
|
{code3: 'nap', code2: '', name: 'Neapolitan'},
|
||||||
{code3: 'nau', code2: 'na', name: 'Nauru'},
|
{code3: 'nau', code2: 'na', name: 'Nauru'},
|
||||||
{code3: 'nav', code2: 'nv', name: 'Navajo; Navaho'},
|
{code3: 'nav', code2: 'nv', name: 'Navajo'},
|
||||||
{code3: 'nbl', code2: 'nr', name: 'Ndebele, South; South Ndebele'},
|
{code3: 'nbl', code2: 'nr', name: 'South Ndebele'},
|
||||||
{code3: 'nde', code2: 'nd', name: 'Ndebele, North; North Ndebele'},
|
{code3: 'nde', code2: 'nd', name: 'North Ndebele'},
|
||||||
{code3: 'ndo', code2: 'ng', name: 'Ndonga'},
|
{code3: 'ndo', code2: 'ng', name: 'Ndonga'},
|
||||||
{
|
{
|
||||||
code3: 'nds',
|
code3: 'nds',
|
||||||
@@ -440,8 +432,8 @@ export const LANGUAGES: Language[] = [
|
|||||||
{code3: 'nic', code2: '', name: 'Niger-Kordofanian languages'},
|
{code3: 'nic', code2: '', name: 'Niger-Kordofanian languages'},
|
||||||
{code3: 'niu', code2: '', name: 'Niuean'},
|
{code3: 'niu', code2: '', name: 'Niuean'},
|
||||||
{code3: 'nld', code2: 'nl', name: 'Dutch; Flemish'},
|
{code3: 'nld', code2: 'nl', name: 'Dutch; Flemish'},
|
||||||
{code3: 'nno', code2: 'nn', name: 'Norwegian Nynorsk; Nynorsk, Norwegian'},
|
{code3: 'nno', code2: 'nn', name: 'Norwegian Nynorsk'},
|
||||||
{code3: 'nob', code2: 'nb', name: 'Bokmål, Norwegian; Norwegian Bokmål'},
|
{code3: 'nob', code2: 'nb', name: 'Norwegian Bokmål'},
|
||||||
{code3: 'nog', code2: '', name: 'Nogai'},
|
{code3: 'nog', code2: '', name: 'Nogai'},
|
||||||
{code3: 'non', code2: '', name: 'Norse, Old'},
|
{code3: 'non', code2: '', name: 'Norse, Old'},
|
||||||
{code3: 'nor', code2: 'no', name: 'Norwegian'},
|
{code3: 'nor', code2: 'no', name: 'Norwegian'},
|
||||||
@@ -463,7 +455,7 @@ export const LANGUAGES: Language[] = [
|
|||||||
{code3: 'ori', code2: 'or', name: 'Oriya'},
|
{code3: 'ori', code2: 'or', name: 'Oriya'},
|
||||||
{code3: 'orm', code2: 'om', name: 'Oromo'},
|
{code3: 'orm', code2: 'om', name: 'Oromo'},
|
||||||
{code3: 'osa', code2: '', name: 'Osage'},
|
{code3: 'osa', code2: '', name: 'Osage'},
|
||||||
{code3: 'oss', code2: 'os', name: 'Ossetian; Ossetic'},
|
{code3: 'oss', code2: 'os', name: 'Ossetic'},
|
||||||
{code3: 'ota', code2: '', name: 'Turkish, Ottoman (1500-1928)'},
|
{code3: 'ota', code2: '', name: 'Turkish, Ottoman (1500-1928)'},
|
||||||
{code3: 'oto', code2: '', name: 'Otomian languages'},
|
{code3: 'oto', code2: '', name: 'Otomian languages'},
|
||||||
{code3: 'paa', code2: '', name: 'Papuan languages'},
|
{code3: 'paa', code2: '', name: 'Papuan languages'},
|
||||||
|
|||||||
+109
-110
@@ -1,4 +1,4 @@
|
|||||||
import React, {useCallback, useLayoutEffect} from 'react'
|
import React, {useCallback, useLayoutEffect, useMemo} from 'react'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Image,
|
Image,
|
||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {ScrollView as RNGHScrollView} from 'react-native-gesture-handler'
|
import {ScrollView as RNGHScrollView} from 'react-native-gesture-handler'
|
||||||
import RNPickerSelect from 'react-native-picker-select'
|
|
||||||
import {AppBskyActorDefs, AppBskyFeedDefs, moderateProfile} from '@atproto/api'
|
import {AppBskyActorDefs, AppBskyFeedDefs, moderateProfile} from '@atproto/api'
|
||||||
import {
|
import {
|
||||||
FontAwesomeIcon,
|
FontAwesomeIcon,
|
||||||
@@ -57,12 +56,25 @@ import {Text} from '#/view/com/util/text/Text'
|
|||||||
import {Explore} from '#/view/screens/Search/Explore'
|
import {Explore} from '#/view/screens/Search/Explore'
|
||||||
import {SearchLinkCard, SearchProfileCard} from '#/view/shell/desktop/Search'
|
import {SearchLinkCard, SearchProfileCard} from '#/view/shell/desktop/Search'
|
||||||
import {makeSearchQuery, parseSearchQuery} from '#/screens/Search/utils'
|
import {makeSearchQuery, parseSearchQuery} from '#/screens/Search/utils'
|
||||||
import {atoms as a, tokens, useBreakpoints, useTheme, web} from '#/alf'
|
import {
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
atoms as a,
|
||||||
|
native,
|
||||||
|
platform,
|
||||||
|
tokens,
|
||||||
|
useBreakpoints,
|
||||||
|
useTheme,
|
||||||
|
web,
|
||||||
|
} from '#/alf'
|
||||||
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import * as FeedCard from '#/components/FeedCard'
|
import * as FeedCard from '#/components/FeedCard'
|
||||||
import {SearchInput} from '#/components/forms/SearchInput'
|
import {SearchInput} from '#/components/forms/SearchInput'
|
||||||
import {ChevronBottom_Stroke2_Corner0_Rounded as ChevronDown} from '#/components/icons/Chevron'
|
import {
|
||||||
|
ChevronBottom_Stroke2_Corner0_Rounded as ChevronDownIcon,
|
||||||
|
ChevronTopBottom_Stroke2_Corner0_Rounded as ChevronUpDownIcon,
|
||||||
|
} from '#/components/icons/Chevron'
|
||||||
|
import {Earth_Stroke2_Corner0_Rounded as EarthIcon} from '#/components/icons/Globe'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
|
import * as Menu from '#/components/Menu'
|
||||||
import {account, useStorage} from '#/storage'
|
import {account, useStorage} from '#/storage'
|
||||||
|
|
||||||
function Loader() {
|
function Loader() {
|
||||||
@@ -315,103 +327,95 @@ function SearchLanguageDropdown({
|
|||||||
value: string
|
value: string
|
||||||
onChange(value: string): void
|
onChange(value: string): void
|
||||||
}) {
|
}) {
|
||||||
const t = useTheme()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {appLanguage, contentLanguages} = useLanguagePrefs()
|
const {appLanguage, contentLanguages} = useLanguagePrefs()
|
||||||
|
|
||||||
const items = React.useMemo(() => {
|
const languages = useMemo(() => {
|
||||||
return [
|
return LANGUAGES.filter(
|
||||||
{
|
(lang, index, self) =>
|
||||||
label: _(msg`Any language`),
|
Boolean(lang.code2) && // reduce to the code2 varieties
|
||||||
inputLabel: _(msg`Any language`),
|
index === self.findIndex(t => t.code2 === lang.code2), // remove dupes (which will happen)
|
||||||
value: '',
|
|
||||||
key: '*',
|
|
||||||
},
|
|
||||||
].concat(
|
|
||||||
LANGUAGES.filter(
|
|
||||||
(lang, index, self) =>
|
|
||||||
Boolean(lang.code2) && // reduce to the code2 varieties
|
|
||||||
index === self.findIndex(t => t.code2 === lang.code2), // remove dupes (which will happen)
|
|
||||||
)
|
|
||||||
.map(l => ({
|
|
||||||
label: languageName(l, appLanguage),
|
|
||||||
inputLabel: languageName(l, appLanguage),
|
|
||||||
value: l.code2,
|
|
||||||
key: l.code2 + l.code3,
|
|
||||||
}))
|
|
||||||
.sort((a, b) => {
|
|
||||||
// prioritize user's languages
|
|
||||||
const aIsUser = contentLanguages.includes(a.value)
|
|
||||||
const bIsUser = contentLanguages.includes(b.value)
|
|
||||||
if (aIsUser && !bIsUser) return -1
|
|
||||||
if (bIsUser && !aIsUser) return 1
|
|
||||||
// prioritize "common" langs in the network
|
|
||||||
const aIsCommon = !!APP_LANGUAGES.find(al => al.code2 === a.value)
|
|
||||||
const bIsCommon = !!APP_LANGUAGES.find(al => al.code2 === b.value)
|
|
||||||
if (aIsCommon && !bIsCommon) return -1
|
|
||||||
if (bIsCommon && !aIsCommon) return 1
|
|
||||||
// fall back to alphabetical
|
|
||||||
return a.label.localeCompare(b.label)
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
}, [_, appLanguage, contentLanguages])
|
.map(l => ({
|
||||||
|
label: languageName(l, appLanguage),
|
||||||
|
value: l.code2,
|
||||||
|
key: l.code2 + l.code3,
|
||||||
|
}))
|
||||||
|
.sort((a, b) => {
|
||||||
|
// prioritize user's languages
|
||||||
|
const aIsUser = contentLanguages.includes(a.value)
|
||||||
|
const bIsUser = contentLanguages.includes(b.value)
|
||||||
|
if (aIsUser && !bIsUser) return -1
|
||||||
|
if (bIsUser && !aIsUser) return 1
|
||||||
|
// prioritize "common" langs in the network
|
||||||
|
const aIsCommon = !!APP_LANGUAGES.find(al => al.code2 === a.value)
|
||||||
|
const bIsCommon = !!APP_LANGUAGES.find(al => al.code2 === b.value)
|
||||||
|
if (aIsCommon && !bIsCommon) return -1
|
||||||
|
if (bIsCommon && !aIsCommon) return 1
|
||||||
|
// fall back to alphabetical
|
||||||
|
return a.label.localeCompare(b.label)
|
||||||
|
})
|
||||||
|
}, [appLanguage, contentLanguages])
|
||||||
|
|
||||||
const style = {
|
const currentLanguageLabel =
|
||||||
backgroundColor: t.atoms.bg_contrast_25.backgroundColor,
|
languages.find(lang => lang.value === value)?.label ?? _(msg`All languages`)
|
||||||
color: t.atoms.text.color,
|
|
||||||
fontSize: a.text_xs.fontSize,
|
|
||||||
fontFamily: 'inherit',
|
|
||||||
fontWeight: a.font_bold.fontWeight,
|
|
||||||
paddingHorizontal: 14,
|
|
||||||
paddingRight: 32,
|
|
||||||
paddingVertical: 8,
|
|
||||||
borderRadius: a.rounded_full.borderRadius,
|
|
||||||
borderWidth: a.border.borderWidth,
|
|
||||||
borderColor: t.atoms.border_contrast_low.borderColor,
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RNPickerSelect
|
<Menu.Root>
|
||||||
darkTheme={t.scheme === 'dark'}
|
<Menu.Trigger
|
||||||
placeholder={{}}
|
label={_(
|
||||||
value={value}
|
msg`Filter search by language (currently: ${currentLanguageLabel})`,
|
||||||
onValueChange={onChange}
|
)}>
|
||||||
items={items}
|
{({props}) => (
|
||||||
Icon={() => (
|
<Button
|
||||||
<ChevronDown fill={t.atoms.text_contrast_low.color} size="sm" />
|
{...props}
|
||||||
)}
|
label={props.accessibilityLabel}
|
||||||
useNativeAndroidPickerStyle={false}
|
size="small"
|
||||||
style={{
|
color={platform({native: 'primary', default: 'secondary'})}
|
||||||
iconContainer: {
|
variant={platform({native: 'ghost', default: 'solid'})}
|
||||||
pointerEvents: 'none',
|
style={native([
|
||||||
right: a.px_sm.paddingRight,
|
a.py_sm,
|
||||||
top: 0,
|
a.px_sm,
|
||||||
bottom: 0,
|
{marginRight: tokens.space.sm * -1},
|
||||||
display: 'flex',
|
])}>
|
||||||
justifyContent: 'center',
|
<ButtonIcon icon={EarthIcon} />
|
||||||
},
|
<ButtonText>{currentLanguageLabel}</ButtonText>
|
||||||
inputAndroid: {
|
<ButtonIcon
|
||||||
...style,
|
icon={platform({
|
||||||
paddingVertical: 2,
|
native: ChevronUpDownIcon,
|
||||||
},
|
default: ChevronDownIcon,
|
||||||
inputIOS: {
|
})}
|
||||||
...style,
|
/>
|
||||||
},
|
</Button>
|
||||||
inputWeb: web({
|
)}
|
||||||
...style,
|
</Menu.Trigger>
|
||||||
cursor: 'pointer',
|
<Menu.Outer
|
||||||
// @ts-ignore web only
|
// HACKFIX: Currently there is no height limit for Radix dropdowns,
|
||||||
'-moz-appearance': 'none',
|
// so if it's too tall it just goes off screen. TODO: fix internally -sfn
|
||||||
'-webkit-appearance': 'none',
|
style={web({maxHeight: '70vh'})}>
|
||||||
appearance: 'none',
|
<Menu.LabelText>
|
||||||
outline: 0,
|
<Trans>Filter search by language</Trans>
|
||||||
borderWidth: 0,
|
</Menu.LabelText>
|
||||||
overflow: 'hidden',
|
<Menu.Item label={_(msg`All languages`)} onPress={() => onChange('')}>
|
||||||
whiteSpace: 'nowrap',
|
<Menu.ItemText>
|
||||||
textOverflow: 'ellipsis',
|
<Trans>All languages</Trans>
|
||||||
}),
|
</Menu.ItemText>
|
||||||
}}
|
<Menu.ItemRadio selected={value === ''} />
|
||||||
/>
|
</Menu.Item>
|
||||||
|
<Menu.Divider />
|
||||||
|
<Menu.Group>
|
||||||
|
{languages.map(lang => (
|
||||||
|
<Menu.Item
|
||||||
|
key={lang.key}
|
||||||
|
label={lang.label}
|
||||||
|
onPress={() => onChange(lang.value)}>
|
||||||
|
<Menu.ItemText>{lang.label}</Menu.ItemText>
|
||||||
|
<Menu.ItemRadio selected={value === lang.value} />
|
||||||
|
</Menu.Item>
|
||||||
|
))}
|
||||||
|
</Menu.Group>
|
||||||
|
</Menu.Outer>
|
||||||
|
</Menu.Root>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -795,22 +799,19 @@ export function SearchScreen(
|
|||||||
// HACK: shift up search input. we can't remove the top padding
|
// HACK: shift up search input. we can't remove the top padding
|
||||||
// on the search input because it messes up the layout animation
|
// on the search input because it messes up the layout animation
|
||||||
// if we add it only when the header is hidden
|
// if we add it only when the header is hidden
|
||||||
style={{marginBottom: tokens.space.sm * -1}}>
|
style={{marginBottom: tokens.space.xs * -1}}>
|
||||||
<Layout.Header.Outer noBottomBorder>
|
<Layout.Header.Outer noBottomBorder>
|
||||||
<Layout.Header.MenuButton />
|
<Layout.Header.MenuButton />
|
||||||
<Layout.Header.Content
|
<Layout.Header.Content align="left">
|
||||||
align={showFilters ? 'left' : 'platform'}>
|
|
||||||
<Layout.Header.TitleText>
|
<Layout.Header.TitleText>
|
||||||
<Trans>Search</Trans>
|
<Trans>Search</Trans>
|
||||||
</Layout.Header.TitleText>
|
</Layout.Header.TitleText>
|
||||||
</Layout.Header.Content>
|
</Layout.Header.Content>
|
||||||
{showFilters ? (
|
{showFilters ? (
|
||||||
<View style={[{minWidth: 140}]}>
|
<SearchLanguageDropdown
|
||||||
<SearchLanguageDropdown
|
value={params.lang}
|
||||||
value={params.lang}
|
onChange={params.setLang}
|
||||||
onChange={params.setLang}
|
/>
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
) : (
|
) : (
|
||||||
<Layout.Header.Slot />
|
<Layout.Header.Slot />
|
||||||
)}
|
)}
|
||||||
@@ -856,12 +857,10 @@ export function SearchScreen(
|
|||||||
a.justify_between,
|
a.justify_between,
|
||||||
a.gap_sm,
|
a.gap_sm,
|
||||||
]}>
|
]}>
|
||||||
<View style={[{width: 140}]}>
|
<SearchLanguageDropdown
|
||||||
<SearchLanguageDropdown
|
value={params.lang}
|
||||||
value={params.lang}
|
onChange={params.setLang}
|
||||||
onChange={params.setLang}
|
/>
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
|
|||||||
import {PressableWithHover} from '#/view/com/util/PressableWithHover'
|
import {PressableWithHover} from '#/view/com/util/PressableWithHover'
|
||||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {NavSignupCard} from '#/view/shell/NavSignupCard'
|
import {NavSignupCard} from '#/view/shell/NavSignupCard'
|
||||||
import {atoms as a, tokens, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, tokens, useBreakpoints, useTheme, web} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import {DialogControlProps} from '#/components/Dialog'
|
import {DialogControlProps} from '#/components/Dialog'
|
||||||
import {ArrowBoxLeft_Stroke2_Corner0_Rounded as LeaveIcon} from '#/components/icons/ArrowBoxLeft'
|
import {ArrowBoxLeft_Stroke2_Corner0_Rounded as LeaveIcon} from '#/components/icons/ArrowBoxLeft'
|
||||||
@@ -235,7 +235,10 @@ function SwitchMenuItems({
|
|||||||
closeEverything()
|
closeEverything()
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Menu.Outer>
|
<Menu.Outer
|
||||||
|
// HACKFIX: Currently there is no height limit for Radix dropdowns,
|
||||||
|
// so if it's too tall it just goes off screen. TODO: fix internally -sfn
|
||||||
|
style={web({maxHeight: '70vh'})}>
|
||||||
{accounts && accounts.length > 0 && (
|
{accounts && accounts.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<Menu.Group>
|
<Menu.Group>
|
||||||
|
|||||||
Reference in New Issue
Block a user