diff options
author | Minseo Lee <itoupluk427@gmail.com> | 2024-03-10 22:50:48 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-10 22:50:48 +0900 |
commit | 236223d02aa61d8f9011c7484c4e8827d336ecb6 (patch) | |
tree | 2e4ac0c8581a942332447a041b28dd5fa608e283 /src/components/Prompt.tsx | |
parent | e74c46e9ab480959c4416f83a78289e460bdeec7 (diff) | |
parent | 1aaed1cc0d59ecafa1bb3c7f57f0a323940e6317 (diff) | |
download | voidsky-236223d02aa61d8f9011c7484c4e8827d336ecb6.tar.zst |
Merge branch 'bluesky-social:main' into patch-3
Diffstat (limited to 'src/components/Prompt.tsx')
-rw-r--r-- | src/components/Prompt.tsx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx index 8e55bd834..3b245c440 100644 --- a/src/components/Prompt.tsx +++ b/src/components/Prompt.tsx @@ -3,7 +3,7 @@ import {View, PressableProps} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' -import {useTheme, atoms as a} from '#/alf' +import {useTheme, atoms as a, useBreakpoints} from '#/alf' import {Text} from '#/components/Typography' import {Button} from '#/components/Button' @@ -25,6 +25,7 @@ export function Outer({ }: React.PropsWithChildren<{ control: Dialog.DialogOuterProps['control'] }>) { + const {gtMobile} = useBreakpoints() const titleId = React.useId() const descriptionId = React.useId() @@ -38,12 +39,12 @@ export function Outer({ <Context.Provider value={context}> <Dialog.Handle /> - <Dialog.Inner + <Dialog.ScrollableInner accessibilityLabelledBy={titleId} accessibilityDescribedBy={descriptionId} - style={[{width: 'auto', maxWidth: 400}]}> + style={[gtMobile ? {width: 'auto', maxWidth: 400} : a.w_full]}> {children} - </Dialog.Inner> + </Dialog.ScrollableInner> </Context.Provider> </Dialog.Outer> ) @@ -71,8 +72,16 @@ export function Description({children}: React.PropsWithChildren<{}>) { } export function Actions({children}: React.PropsWithChildren<{}>) { + const {gtMobile} = useBreakpoints() + return ( - <View style={[a.w_full, a.flex_row, a.gap_sm, a.justify_end]}> + <View + style={[ + a.w_full, + a.gap_sm, + a.justify_end, + gtMobile ? [a.flex_row] : [a.flex_col, a.pt_md, a.pb_4xl], + ]}> {children} </View> ) @@ -82,12 +91,13 @@ export function Cancel({ children, }: React.PropsWithChildren<{onPress?: PressableProps['onPress']}>) { const {_} = useLingui() + const {gtMobile} = useBreakpoints() const {close} = Dialog.useDialogContext() return ( <Button variant="solid" color="secondary" - size="small" + size={gtMobile ? 'small' : 'medium'} label={_(msg`Cancel`)} onPress={() => close()}> {children} @@ -100,6 +110,7 @@ export function Action({ onPress, }: React.PropsWithChildren<{onPress?: () => void}>) { const {_} = useLingui() + const {gtMobile} = useBreakpoints() const {close} = Dialog.useDialogContext() const handleOnPress = React.useCallback(() => { close() @@ -109,7 +120,7 @@ export function Action({ <Button variant="solid" color="primary" - size="small" + size={gtMobile ? 'small' : 'medium'} label={_(msg`Confirm`)} onPress={handleOnPress}> {children} |