More layouts

This commit is contained in:
Dan Abramov
2023-12-08 02:35:40 +00:00
parent d3ed9abd8d
commit 840c07ddf2
3 changed files with 24 additions and 6 deletions
@@ -30,7 +30,7 @@ export function EmojiPickerButton() {
return ( return (
<DropdownMenu.Root open={open} onOpenChange={onOpenChange}> <DropdownMenu.Root open={open} onOpenChange={onOpenChange}>
<DropdownMenu.Trigger style={styles.trigger}> <DropdownMenu.Trigger style={styles.trigger as React.CSSProperties}>
<FontAwesomeIcon <FontAwesomeIcon
icon={['far', 'face-smile']} icon={['far', 'face-smile']}
color={pal.colors.link} color={pal.colors.link}
@@ -87,7 +87,8 @@ export function EmojiPicker({close}: {close: () => void}) {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
mask: { mask: {
position: 'absolute', // @ts-ignore web ony
position: 'fixed',
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
@@ -96,6 +97,7 @@ const styles = StyleSheet.create({
}, },
trigger: { trigger: {
backgroundColor: 'transparent', backgroundColor: 'transparent',
// @ts-ignore web only
border: 'none', border: 'none',
paddingTop: 4, paddingTop: 4,
paddingLeft: 12, paddingLeft: 12,
+18 -3
View File
@@ -12,6 +12,7 @@ import {TabBar} from './TabBar'
import {OnScrollHandler} from 'lib/hooks/useOnMainScroll' import {OnScrollHandler} from 'lib/hooks/useOnMainScroll'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {usePalette} from '#/lib/hooks/usePalette' import {usePalette} from '#/lib/hooks/usePalette'
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
const SCROLLED_DOWN_LIMIT = 200 const SCROLLED_DOWN_LIMIT = 200
@@ -152,12 +153,20 @@ let PagerTabBar = ({
onSelect?: (index: number) => void onSelect?: (index: number) => void
}): React.ReactNode => { }): React.ReactNode => {
const pal = usePalette('default') const pal = usePalette('default')
const {isMobile} = useWebMediaQueries()
return ( return (
<> <>
<View style={[styles.headerContainer, pal.border]}> <View style={[!isMobile && styles.headerContainerDesktop, pal.border]}>
{renderHeader?.()} {renderHeader?.()}
</View> </View>
<View style={[styles.tabBarContainer, pal.border]}> <View
style={[
styles.tabBarContainer,
isMobile
? styles.tabBarContainerMobile
: styles.tabBarContainerDesktop,
pal.border,
]}>
<TabBar <TabBar
testID={testID} testID={testID}
items={items} items={items}
@@ -202,7 +211,7 @@ function PagerItem({
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
headerContainer: { headerContainerDesktop: {
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',
width: 600, width: 600,
@@ -215,12 +224,18 @@ const styles = StyleSheet.create({
overflow: 'hidden', overflow: 'hidden',
top: 0, top: 0,
zIndex: 1, zIndex: 1,
},
tabBarContainerDesktop: {
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',
width: 600, width: 600,
borderLeftWidth: 1, borderLeftWidth: 1,
borderRightWidth: 1, borderRightWidth: 1,
}, },
tabBarContainerMobile: {
paddingLeft: 14,
paddingRight: 14,
},
}) })
function noop() { function noop() {
+2 -1
View File
@@ -64,7 +64,8 @@ export function show(text: string, icon: FontAwesomeProps['icon'] = 'check') {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
position: 'absolute', // @ts-ignore web only
position: 'fixed',
left: 20, left: 20,
bottom: 20, bottom: 20,
// @ts-ignore web only // @ts-ignore web only