Good on all platforms

This commit is contained in:
Eric Bailey
2024-12-02 16:30:53 -06:00
parent 55a7b2ec67
commit 703d13e3f7
+39 -6
View File
@@ -7,13 +7,20 @@ import {useNavigation} from '@react-navigation/native'
import {NavigationProp} from '#/lib/routes/types' import {NavigationProp} from '#/lib/routes/types'
import {isIOS} from '#/platform/detection' import {isIOS} from '#/platform/detection'
import {useSetDrawerOpen} from '#/state/shell' import {useSetDrawerOpen} from '#/state/shell'
import {atoms as a, useBreakpoints, useGutterStyles, useTheme} from '#/alf' import {
atoms as a,
useBreakpoints,
useGutterStyles,
useTheme,
ViewStyleProp,
} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button' import {Button, ButtonIcon} from '#/components/Button'
import {ArrowLeft_Stroke2_Corner0_Rounded as ArrowLeft} from '#/components/icons/Arrow' import {ArrowLeft_Stroke2_Corner0_Rounded as ArrowLeft} from '#/components/icons/Arrow'
import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu' import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
const BUTTON_VISUAL_ALIGNMENT_OFFSET = 3 const BUTTON_VISUAL_ALIGNMENT_OFFSET = 3
const BUTTON_SIZE = 34 // small button
export function Outer({children}: {children: React.ReactNode}) { export function Outer({children}: {children: React.ReactNode}) {
const t = useTheme() const t = useTheme()
@@ -31,7 +38,7 @@ export function Outer({children}: {children: React.ReactNode}) {
a.py_sm, a.py_sm,
t.atoms.border_contrast_low, t.atoms.border_contrast_low,
]}> ]}>
{children} <View style={[a.flex_1]}>{children}</View>
</View> </View>
) )
} }
@@ -39,14 +46,40 @@ export function Outer({children}: {children: React.ReactNode}) {
export function Content({children}: {children: React.ReactNode}) { export function Content({children}: {children: React.ReactNode}) {
return ( return (
<View <View
style={[a.flex_1, a.justify_center, a.py_xs, isIOS && a.align_center]}> style={[
a.flex_1,
a.justify_center,
a.py_xs,
isIOS && a.align_center,
{
paddingHorizontal: BUTTON_SIZE + a.gap_sm.gap,
minHeight: BUTTON_SIZE,
},
]}>
{children} {children}
</View> </View>
) )
} }
export function Slot({children}: {children: React.ReactNode}) { export function Slot({
return <View style={[{width: 34}]}>{children}</View> children,
style,
}: {children?: React.ReactNode} & ViewStyleProp) {
return (
<View
style={[
a.absolute,
a.inset_0,
a.z_50,
{
width: BUTTON_SIZE,
right: 'auto',
},
style,
]}>
{children}
</View>
)
} }
export function BackButton() { export function BackButton() {
@@ -89,7 +122,7 @@ export function MenuButton() {
return gtMobile ? null : ( return gtMobile ? null : (
<Slot> <Slot>
<Button <Button
label={_(msg`Go back`)} label={_(msg`Open drawer menu`)}
size="small" size="small"
variant="ghost" variant="ghost"
color="secondary" color="secondary"