Adjustments to ALF prompt buttons (Dialogs Pt. 2) (#3144)

* Improve a11y on ios

* Format

* Remove android

* Fix android

* small adjustment to buttons in prompt

* full width below gtmobile

* Revert some changes

* use sharedvalue for `importantForAccessibility`

* add back `isOpen`

* fix some more types

* small adjustment to buttons in prompt

* full width below gtmobile

---------

Co-authored-by: Eric Bailey <git@esb.lol>
zio/stable
Hailey 2024-03-08 14:43:28 -08:00 committed by GitHub
parent 8ee325e73d
commit 62e57c3b08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View File

@ -27,7 +27,7 @@ export type ButtonColor =
| 'gradient_sunset' | 'gradient_sunset'
| 'gradient_nordic' | 'gradient_nordic'
| 'gradient_bonfire' | 'gradient_bonfire'
export type ButtonSize = 'tiny' | 'small' | 'large' export type ButtonSize = 'tiny' | 'small' | 'medium' | 'large'
export type ButtonShape = 'round' | 'square' | 'default' export type ButtonShape = 'round' | 'square' | 'default'
export type VariantProps = { export type VariantProps = {
/** /**
@ -274,6 +274,8 @@ export function Button({
if (shape === 'default') { if (shape === 'default') {
if (size === 'large') { if (size === 'large') {
baseStyles.push({paddingVertical: 15}, a.px_2xl, a.rounded_sm, a.gap_md) baseStyles.push({paddingVertical: 15}, a.px_2xl, a.rounded_sm, a.gap_md)
} else if (size === 'medium') {
baseStyles.push({paddingVertical: 12}, a.px_2xl, a.rounded_sm, a.gap_md)
} else if (size === 'small') { } else if (size === 'small') {
baseStyles.push({paddingVertical: 9}, a.px_lg, a.rounded_sm, a.gap_sm) baseStyles.push({paddingVertical: 9}, a.px_lg, a.rounded_sm, a.gap_sm)
} else if (size === 'tiny') { } else if (size === 'tiny') {

View File

@ -78,10 +78,9 @@ export function Actions({children}: React.PropsWithChildren<{}>) {
<View <View
style={[ style={[
a.w_full, a.w_full,
a.flex_row,
a.gap_sm, a.gap_sm,
a.justify_end, a.justify_end,
gtMobile && [a.pb_4xl], gtMobile ? [a.flex_row] : [a.flex_col, a.pt_md, a.pb_4xl],
]}> ]}>
{children} {children}
</View> </View>
@ -92,12 +91,13 @@ export function Cancel({
children, children,
}: React.PropsWithChildren<{onPress?: PressableProps['onPress']}>) { }: React.PropsWithChildren<{onPress?: PressableProps['onPress']}>) {
const {_} = useLingui() const {_} = useLingui()
const {gtMobile} = useBreakpoints()
const {close} = Dialog.useDialogContext() const {close} = Dialog.useDialogContext()
return ( return (
<Button <Button
variant="solid" variant="solid"
color="secondary" color="secondary"
size="small" size={gtMobile ? 'small' : 'medium'}
label={_(msg`Cancel`)} label={_(msg`Cancel`)}
onPress={() => close()}> onPress={() => close()}>
{children} {children}
@ -110,6 +110,7 @@ export function Action({
onPress, onPress,
}: React.PropsWithChildren<{onPress?: () => void}>) { }: React.PropsWithChildren<{onPress?: () => void}>) {
const {_} = useLingui() const {_} = useLingui()
const {gtMobile} = useBreakpoints()
const {close} = Dialog.useDialogContext() const {close} = Dialog.useDialogContext()
const handleOnPress = React.useCallback(() => { const handleOnPress = React.useCallback(() => {
close() close()
@ -119,7 +120,7 @@ export function Action({
<Button <Button
variant="solid" variant="solid"
color="primary" color="primary"
size="small" size={gtMobile ? 'small' : 'medium'}
label={_(msg`Confirm`)} label={_(msg`Confirm`)}
onPress={handleOnPress}> onPress={handleOnPress}>
{children} {children}