From a3737f00156e8032cc18e0761599afb04cc6ef55 Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 1 Oct 2024 19:14:12 -0700 Subject: [PATCH] replace all buttons with `BottomSheetButton` --- src/components/BottomSheetButton.tsx | 110 +++++ src/components/BottomSheetButton.web.tsx | 3 + src/components/Button.tsx | 465 +++++++++--------- src/components/NewskieDialog.tsx | 5 +- src/components/Prompt.tsx | 20 +- .../ReportDialog/SelectReportOptionView.tsx | 16 +- src/components/ReportDialog/SubmitView.tsx | 11 +- src/components/StarterPack/QrCodeDialog.tsx | 11 +- src/components/StarterPack/ShareDialog.tsx | 15 +- .../Wizard/WizardEditListDialog.tsx | 7 +- src/components/TagMenu/index.tsx | 11 +- src/components/WhoCanReply.tsx | 11 +- src/components/dialogs/BirthDateSettings.tsx | 7 +- src/components/dialogs/Embed.tsx | 7 +- src/components/dialogs/EmbedConsent.tsx | 15 +- src/components/dialogs/GifSelect.tsx | 11 +- src/components/dialogs/MutedWords.tsx | 11 +- .../dialogs/PostInteractionSettingsDialog.tsx | 16 +- src/components/dialogs/Signin.tsx | 11 +- src/components/dms/MessagesNUX.tsx | 7 +- .../dms/dialogs/SearchablePeopleList.tsx | 18 +- src/components/forms/DateField/index.tsx | 7 +- .../intents/VerifyEmailIntentDialog.tsx | 11 +- .../moderation/LabelsOnMeDialog.tsx | 15 +- src/screens/Onboarding/StepProfile/index.tsx | 5 +- src/view/com/auth/server-input/index.tsx | 11 +- src/view/com/composer/GifAltText.tsx | 7 +- .../composer/photos/EditImageDialog.web.tsx | 7 +- .../composer/photos/ImageAltTextDialog.tsx | 7 +- .../com/composer/videos/SubtitleDialog.tsx | 9 +- src/view/com/util/post-ctrls/RepostButton.tsx | 13 +- .../Settings/DisableEmail2FADialog.tsx | 19 +- src/view/screens/Settings/ExportCarDialog.tsx | 7 +- 33 files changed, 533 insertions(+), 373 deletions(-) create mode 100644 src/components/BottomSheetButton.tsx create mode 100644 src/components/BottomSheetButton.web.tsx diff --git a/src/components/BottomSheetButton.tsx b/src/components/BottomSheetButton.tsx new file mode 100644 index 0000000000..50577a8c48 --- /dev/null +++ b/src/components/BottomSheetButton.tsx @@ -0,0 +1,110 @@ +import React from 'react' +import {AccessibilityProps, ViewStyle} from 'react-native' +import {PressableEvent} from 'react-native-gesture-handler/lib/typescript/components/Pressable/PressableProps' +import { + BlueskyBottomSheetPressable, + BueskyBottomSheetPressableProps, +} from '@haileyok/bluesky-bottom-sheet' + +import {atoms as a} from '#/alf' +import { + ButtonContext, + useSharedButtonStyles, + VariantProps, +} from '#/components/Button' + +export function BottomSheetButton({ + children, + label, + color, + variant, + shape = 'default', + size, + disabled, + style, + ...rest +}: BueskyBottomSheetPressableProps & + AccessibilityProps & + VariantProps & { + /** + * For a11y, try to make this descriptive and clear + */ + label: string + }) { + const [state, setState] = React.useState({ + pressed: false, + hovered: false, + focused: false, + }) + + const onPressInOuter = rest.onPressIn + const onPressIn = React.useCallback( + (e: PressableEvent) => { + setState(s => ({ + ...s, + pressed: true, + })) + onPressInOuter?.(e) + }, + [setState, onPressInOuter], + ) + const onPressOutOuter = rest.onPressOut + const onPressOut = React.useCallback( + (e: PressableEvent) => { + setState(s => ({ + ...s, + pressed: false, + })) + onPressOutOuter?.(e) + }, + [setState, onPressOutOuter], + ) + + const {baseStyles, hoverStyles} = useSharedButtonStyles({ + /** + * For a11y, try to make this descriptive and clear + */ + color, + variant, + shape, + size, + disabled, + }) + + const context = React.useMemo( + () => ({ + ...state, + variant, + color, + size, + disabled: disabled || false, + }), + [state, variant, color, size, disabled], + ) + + return ( + + + {typeof children === 'function' ? children(context) : children} + + + ) +} diff --git a/src/components/BottomSheetButton.web.tsx b/src/components/BottomSheetButton.web.tsx new file mode 100644 index 0000000000..c3752a03e4 --- /dev/null +++ b/src/components/BottomSheetButton.web.tsx @@ -0,0 +1,3 @@ +import {Button as BottomSheetButton} from '#/components/Button' + +export {BottomSheetButton} diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 17179994a9..17db0332e0 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -89,7 +89,8 @@ export type ButtonProps = Pick< children: NonTextElements | ((context: ButtonContext) => NonTextElements) } -export type ButtonTextProps = TextProps & VariantProps & {disabled?: boolean} +export type ButtonTextProps = TextProps & + VariantProps & {disabled?: boolean | null} const Context = React.createContext({ hovered: false, @@ -97,6 +98,7 @@ const Context = React.createContext({ pressed: false, disabled: false, }) +export const ButtonContext = Context export function useButtonContext() { return React.useContext(Context) @@ -118,7 +120,6 @@ export const Button = React.forwardRef( }, ref, ) => { - const t = useTheme() const [state, setState] = React.useState({ pressed: false, hovered: false, @@ -182,226 +183,13 @@ export const Button = React.forwardRef( })) }, [setState]) - const {baseStyles, hoverStyles} = React.useMemo(() => { - const baseStyles: ViewStyle[] = [] - const hoverStyles: ViewStyle[] = [] - - if (color === 'primary') { - if (variant === 'solid') { - if (!disabled) { - baseStyles.push({ - backgroundColor: t.palette.primary_500, - }) - hoverStyles.push({ - backgroundColor: t.palette.primary_600, - }) - } else { - baseStyles.push({ - backgroundColor: select(t.name, { - light: t.palette.primary_700, - dim: t.palette.primary_300, - dark: t.palette.primary_300, - }), - }) - } - } else if (variant === 'outline') { - baseStyles.push(a.border, t.atoms.bg, { - borderWidth: 1, - }) - - if (!disabled) { - baseStyles.push(a.border, { - borderColor: t.palette.primary_500, - }) - hoverStyles.push(a.border, { - backgroundColor: t.palette.primary_50, - }) - } else { - baseStyles.push(a.border, { - borderColor: t.palette.primary_200, - }) - } - } else if (variant === 'ghost') { - if (!disabled) { - baseStyles.push(t.atoms.bg) - hoverStyles.push({ - backgroundColor: t.palette.primary_100, - }) - } - } - } else if (color === 'secondary') { - if (variant === 'solid') { - if (!disabled) { - baseStyles.push(t.atoms.bg_contrast_25) - hoverStyles.push(t.atoms.bg_contrast_50) - } else { - baseStyles.push(t.atoms.bg_contrast_100) - } - } else if (variant === 'outline') { - baseStyles.push(a.border, t.atoms.bg, { - borderWidth: 1, - }) - - if (!disabled) { - baseStyles.push(a.border, { - borderColor: t.palette.contrast_300, - }) - hoverStyles.push(t.atoms.bg_contrast_50) - } else { - baseStyles.push(a.border, { - borderColor: t.palette.contrast_200, - }) - } - } else if (variant === 'ghost') { - if (!disabled) { - baseStyles.push(t.atoms.bg) - hoverStyles.push({ - backgroundColor: t.palette.contrast_25, - }) - } - } - } else if (color === 'secondary_inverted') { - if (variant === 'solid') { - if (!disabled) { - baseStyles.push({ - backgroundColor: t.palette.contrast_900, - }) - hoverStyles.push({ - backgroundColor: t.palette.contrast_950, - }) - } else { - baseStyles.push({ - backgroundColor: t.palette.contrast_600, - }) - } - } else if (variant === 'outline') { - baseStyles.push(a.border, t.atoms.bg, { - borderWidth: 1, - }) - - if (!disabled) { - baseStyles.push(a.border, { - borderColor: t.palette.contrast_300, - }) - hoverStyles.push(t.atoms.bg_contrast_50) - } else { - baseStyles.push(a.border, { - borderColor: t.palette.contrast_200, - }) - } - } else if (variant === 'ghost') { - if (!disabled) { - baseStyles.push(t.atoms.bg) - hoverStyles.push({ - backgroundColor: t.palette.contrast_25, - }) - } - } - } else if (color === 'negative') { - if (variant === 'solid') { - if (!disabled) { - baseStyles.push({ - backgroundColor: t.palette.negative_500, - }) - hoverStyles.push({ - backgroundColor: t.palette.negative_600, - }) - } else { - baseStyles.push({ - backgroundColor: select(t.name, { - light: t.palette.negative_700, - dim: t.palette.negative_300, - dark: t.palette.negative_300, - }), - }) - } - } else if (variant === 'outline') { - baseStyles.push(a.border, t.atoms.bg, { - borderWidth: 1, - }) - - if (!disabled) { - baseStyles.push(a.border, { - borderColor: t.palette.negative_500, - }) - hoverStyles.push(a.border, { - backgroundColor: t.palette.negative_50, - }) - } else { - baseStyles.push(a.border, { - borderColor: t.palette.negative_200, - }) - } - } else if (variant === 'ghost') { - if (!disabled) { - baseStyles.push(t.atoms.bg) - hoverStyles.push({ - backgroundColor: t.palette.negative_100, - }) - } - } - } - - if (shape === 'default') { - if (size === 'large') { - baseStyles.push({ - paddingVertical: 13, - paddingHorizontal: 20, - borderRadius: 8, - gap: 8, - }) - } else if (size === 'small') { - baseStyles.push({ - paddingVertical: 8, - paddingHorizontal: 12, - borderRadius: 6, - gap: 6, - }) - } else if (size === 'tiny') { - baseStyles.push({ - paddingVertical: 4, - paddingHorizontal: 8, - borderRadius: 4, - gap: 4, - }) - } - } else if (shape === 'round' || shape === 'square') { - if (size === 'large') { - if (shape === 'round') { - baseStyles.push({height: 46, width: 46}) - } else { - baseStyles.push({height: 44, width: 44}) - } - } else if (size === 'small') { - if (shape === 'round') { - baseStyles.push({height: 36, width: 36}) - } else { - baseStyles.push({height: 34, width: 34}) - } - } else if (size === 'tiny') { - if (shape === 'round') { - baseStyles.push({height: 22, width: 22}) - } else { - baseStyles.push({height: 21, width: 21}) - } - } - - if (shape === 'round') { - baseStyles.push(a.rounded_full) - } else if (shape === 'square') { - if (size === 'tiny') { - baseStyles.push(a.rounded_xs) - } else { - baseStyles.push(a.rounded_sm) - } - } - } - - return { - baseStyles, - hoverStyles, - } - }, [t, variant, color, size, shape, disabled]) + const {baseStyles, hoverStyles} = useSharedButtonStyles({ + color, + variant, + disabled, + shape, + size, + }) const {gradientColors, gradientHoverColors, gradientLocations} = React.useMemo(() => { @@ -506,6 +294,239 @@ export const Button = React.forwardRef( ) Button.displayName = 'Button' +export function useSharedButtonStyles({ + color, + variant, + disabled, + shape, + size, +}: VariantProps & {disabled?: boolean | null}) { + const t = useTheme() + + const {baseStyles, hoverStyles} = React.useMemo(() => { + const baseStyles: ViewStyle[] = [] + const hoverStyles: ViewStyle[] = [] + + if (color === 'primary') { + if (variant === 'solid') { + if (!disabled) { + baseStyles.push({ + backgroundColor: t.palette.primary_500, + }) + hoverStyles.push({ + backgroundColor: t.palette.primary_600, + }) + } else { + baseStyles.push({ + backgroundColor: select(t.name, { + light: t.palette.primary_700, + dim: t.palette.primary_300, + dark: t.palette.primary_300, + }), + }) + } + } else if (variant === 'outline') { + baseStyles.push(a.border, t.atoms.bg, { + borderWidth: 1, + }) + + if (!disabled) { + baseStyles.push(a.border, { + borderColor: t.palette.primary_500, + }) + hoverStyles.push(a.border, { + backgroundColor: t.palette.primary_50, + }) + } else { + baseStyles.push(a.border, { + borderColor: t.palette.primary_200, + }) + } + } else if (variant === 'ghost') { + if (!disabled) { + baseStyles.push(t.atoms.bg) + hoverStyles.push({ + backgroundColor: t.palette.primary_100, + }) + } + } + } else if (color === 'secondary') { + if (variant === 'solid') { + if (!disabled) { + baseStyles.push(t.atoms.bg_contrast_25) + hoverStyles.push(t.atoms.bg_contrast_50) + } else { + baseStyles.push(t.atoms.bg_contrast_100) + } + } else if (variant === 'outline') { + baseStyles.push(a.border, t.atoms.bg, { + borderWidth: 1, + }) + + if (!disabled) { + baseStyles.push(a.border, { + borderColor: t.palette.contrast_300, + }) + hoverStyles.push(t.atoms.bg_contrast_50) + } else { + baseStyles.push(a.border, { + borderColor: t.palette.contrast_200, + }) + } + } else if (variant === 'ghost') { + if (!disabled) { + baseStyles.push(t.atoms.bg) + hoverStyles.push({ + backgroundColor: t.palette.contrast_25, + }) + } + } + } else if (color === 'secondary_inverted') { + if (variant === 'solid') { + if (!disabled) { + baseStyles.push({ + backgroundColor: t.palette.contrast_900, + }) + hoverStyles.push({ + backgroundColor: t.palette.contrast_950, + }) + } else { + baseStyles.push({ + backgroundColor: t.palette.contrast_600, + }) + } + } else if (variant === 'outline') { + baseStyles.push(a.border, t.atoms.bg, { + borderWidth: 1, + }) + + if (!disabled) { + baseStyles.push(a.border, { + borderColor: t.palette.contrast_300, + }) + hoverStyles.push(t.atoms.bg_contrast_50) + } else { + baseStyles.push(a.border, { + borderColor: t.palette.contrast_200, + }) + } + } else if (variant === 'ghost') { + if (!disabled) { + baseStyles.push(t.atoms.bg) + hoverStyles.push({ + backgroundColor: t.palette.contrast_25, + }) + } + } + } else if (color === 'negative') { + if (variant === 'solid') { + if (!disabled) { + baseStyles.push({ + backgroundColor: t.palette.negative_500, + }) + hoverStyles.push({ + backgroundColor: t.palette.negative_600, + }) + } else { + baseStyles.push({ + backgroundColor: select(t.name, { + light: t.palette.negative_700, + dim: t.palette.negative_300, + dark: t.palette.negative_300, + }), + }) + } + } else if (variant === 'outline') { + baseStyles.push(a.border, t.atoms.bg, { + borderWidth: 1, + }) + + if (!disabled) { + baseStyles.push(a.border, { + borderColor: t.palette.negative_500, + }) + hoverStyles.push(a.border, { + backgroundColor: t.palette.negative_50, + }) + } else { + baseStyles.push(a.border, { + borderColor: t.palette.negative_200, + }) + } + } else if (variant === 'ghost') { + if (!disabled) { + baseStyles.push(t.atoms.bg) + hoverStyles.push({ + backgroundColor: t.palette.negative_100, + }) + } + } + } + + if (shape === 'default') { + if (size === 'large') { + baseStyles.push({ + paddingVertical: 13, + paddingHorizontal: 20, + borderRadius: 8, + gap: 8, + }) + } else if (size === 'small') { + baseStyles.push({ + paddingVertical: 8, + paddingHorizontal: 12, + borderRadius: 6, + gap: 6, + }) + } else if (size === 'tiny') { + baseStyles.push({ + paddingVertical: 4, + paddingHorizontal: 8, + borderRadius: 4, + gap: 4, + }) + } + } else if (shape === 'round' || shape === 'square') { + if (size === 'large') { + if (shape === 'round') { + baseStyles.push({height: 46, width: 46}) + } else { + baseStyles.push({height: 44, width: 44}) + } + } else if (size === 'small') { + if (shape === 'round') { + baseStyles.push({height: 36, width: 36}) + } else { + baseStyles.push({height: 34, width: 34}) + } + } else if (size === 'tiny') { + if (shape === 'round') { + baseStyles.push({height: 22, width: 22}) + } else { + baseStyles.push({height: 21, width: 21}) + } + } + + if (shape === 'round') { + baseStyles.push(a.rounded_full) + } else if (shape === 'square') { + if (size === 'tiny') { + baseStyles.push(a.rounded_xs) + } else { + baseStyles.push(a.rounded_sm) + } + } + } + + return { + baseStyles, + hoverStyles, + } + }, [t, variant, color, size, shape, disabled]) + + return {baseStyles, hoverStyles} +} + export function useSharedButtonTextStyles() { const t = useTheme() const {color, variant, disabled, size} = useButtonContext() diff --git a/src/components/NewskieDialog.tsx b/src/components/NewskieDialog.tsx index e25f48edf5..0ed29babb1 100644 --- a/src/components/NewskieDialog.tsx +++ b/src/components/NewskieDialog.tsx @@ -12,6 +12,7 @@ import {isNative} from '#/platform/detection' import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useSession} from '#/state/session' import {atoms as a, useTheme} from '#/alf' +import {BottomSheetButton} from '#/components/BottomSheetButton' import {Button, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {useDialogControl} from '#/components/Dialog' @@ -141,7 +142,7 @@ export function NewskieDialog({ ) : null} {isNative && ( - + )} diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx index 8aa111bf3d..0e1442d7c8 100644 --- a/src/components/Prompt.tsx +++ b/src/components/Prompt.tsx @@ -1,10 +1,12 @@ import React from 'react' -import {GestureResponderEvent, View} from 'react-native' +import {View} from 'react-native' +import {PressableEvent} from 'react-native-gesture-handler/lib/typescript/components/Pressable/PressableProps' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import {Button, ButtonColor, ButtonProps, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonColor, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {Text} from '#/components/Typography' @@ -115,14 +117,14 @@ export function Cancel({ }, [close]) return ( - + ) } @@ -139,7 +141,7 @@ export function Action({ * Note: The dialog will close automatically when the action is pressed, you * should NOT close the dialog as a side effect of this method. */ - onPress: ButtonProps['onPress'] + onPress: (e: PressableEvent) => void color?: ButtonColor /** * Optional i18n string. If undefined, it will default to "Confirm". @@ -151,14 +153,14 @@ export function Action({ const {gtMobile} = useBreakpoints() const {close} = Dialog.useDialogContext() const handleOnPress = React.useCallback( - (e: GestureResponderEvent) => { + (e: PressableEvent) => { close(() => onPress?.(e)) }, [close, onPress], ) return ( - + ) } @@ -192,7 +194,7 @@ export function Basic({ * Note: The dialog will close automatically when the action is pressed, you * should NOT close the dialog as a side effect of this method. */ - onConfirm: ButtonProps['onPress'] + onConfirm: (e: PressableEvent) => void confirmButtonColor?: ButtonColor showCancel?: boolean }>) { diff --git a/src/components/ReportDialog/SelectReportOptionView.tsx b/src/components/ReportDialog/SelectReportOptionView.tsx index 169c07d732..82ada250a6 100644 --- a/src/components/ReportDialog/SelectReportOptionView.tsx +++ b/src/components/ReportDialog/SelectReportOptionView.tsx @@ -10,12 +10,8 @@ import {DMCA_LINK} from '#/components/ReportDialog/const' export {useDialogControl as useReportDialogControl} from '#/components/Dialog' import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import { - Button, - ButtonIcon, - ButtonText, - useButtonContext, -} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonIcon, ButtonText, useButtonContext} from '#/components/Button' import {Divider} from '#/components/Divider' import { ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft, @@ -72,7 +68,7 @@ export function SelectReportOptionView({ return ( {props.labelers?.length > 1 ? ( - + ) : null} @@ -95,7 +91,7 @@ export function SelectReportOptionView({ {reportOptions.map(reportOption => { return ( - + ) })} diff --git a/src/components/ReportDialog/SubmitView.tsx b/src/components/ReportDialog/SubmitView.tsx index e323d15042..590945c267 100644 --- a/src/components/ReportDialog/SubmitView.tsx +++ b/src/components/ReportDialog/SubmitView.tsx @@ -10,7 +10,8 @@ import {useAgent} from '#/state/session' import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' import * as Toast from '#/view/com/util/Toast' import {atoms as a, native, useTheme} from '#/alf' -import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as Toggle from '#/components/forms/Toggle' import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' @@ -100,7 +101,7 @@ export function SubmitView({ return ( - + ))} - + ) diff --git a/src/components/StarterPack/QrCodeDialog.tsx b/src/components/StarterPack/QrCodeDialog.tsx index 2feea0973a..b7dbd66cd0 100644 --- a/src/components/StarterPack/QrCodeDialog.tsx +++ b/src/components/StarterPack/QrCodeDialog.tsx @@ -13,7 +13,8 @@ import {logger} from '#/logger' import {isNative, isWeb} from '#/platform/detection' import * as Toast from '#/view/com/util/Toast' import {atoms as a} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {DialogControlProps} from '#/components/Dialog' import {Loader} from '#/components/Loader' @@ -165,7 +166,7 @@ export function QrCodeDialog({ ) : ( - - + )} diff --git a/src/components/StarterPack/ShareDialog.tsx b/src/components/StarterPack/ShareDialog.tsx index 494aceae1f..ec12907cb0 100644 --- a/src/components/StarterPack/ShareDialog.tsx +++ b/src/components/StarterPack/ShareDialog.tsx @@ -15,7 +15,8 @@ import {logger} from '#/logger' import {isNative, isWeb} from '#/platform/detection' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useTheme} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import {DialogControlProps} from '#/components/Dialog' import * as Dialog from '#/components/Dialog' import {Loader} from '#/components/Loader' @@ -119,7 +120,7 @@ function ShareDialogInner({ a.gap_md, isWeb && [a.gap_sm, a.flex_row_reverse, {marginLeft: 'auto'}], ]}> - - + {isNative && ( - + )} diff --git a/src/components/StarterPack/Wizard/WizardEditListDialog.tsx b/src/components/StarterPack/Wizard/WizardEditListDialog.tsx index d1ecdc8821..3400bed4b6 100644 --- a/src/components/StarterPack/Wizard/WizardEditListDialog.tsx +++ b/src/components/StarterPack/Wizard/WizardEditListDialog.tsx @@ -12,7 +12,8 @@ import {useSession} from '#/state/session' import {ListMethods} from '#/view/com/util/List' import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State' import {atoms as a, native, useTheme, web} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import { WizardFeedCard, @@ -111,7 +112,7 @@ export function WizardEditListDialog({ {isWeb && ( - + )} diff --git a/src/components/TagMenu/index.tsx b/src/components/TagMenu/index.tsx index 2e4249609a..8b6a62e440 100644 --- a/src/components/TagMenu/index.tsx +++ b/src/components/TagMenu/index.tsx @@ -13,7 +13,8 @@ import { useUpsertMutedWordsMutation, } from '#/state/queries/preferences' import {atoms as a, native, useTheme} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {Divider} from '#/components/Divider' import {MagnifyingGlass2_Stroke2_Corner0_Rounded as Search} from '#/components/icons/MagnifyingGlass2' @@ -211,7 +212,7 @@ export function TagMenu({ <> - + ) : null} - + )} diff --git a/src/components/WhoCanReply.tsx b/src/components/WhoCanReply.tsx index 2839943c97..ba9970af42 100644 --- a/src/components/WhoCanReply.tsx +++ b/src/components/WhoCanReply.tsx @@ -17,7 +17,7 @@ import { threadgateViewToAllowUISetting, } from '#/state/queries/threadgate' import {atoms as a, useTheme} from '#/alf' -import {Button} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' import * as Dialog from '#/components/Dialog' import {useDialogControl} from '#/components/Dialog' import { @@ -82,7 +82,7 @@ export function WhoCanReply({post, isThreadAuthor, style}: WhoCanReplyProps) { return ( <> - + {isThreadAuthor ? ( - + ) diff --git a/src/components/dialogs/Embed.tsx b/src/components/dialogs/Embed.tsx index 7aa2a4fc1e..525010230e 100644 --- a/src/components/dialogs/Embed.tsx +++ b/src/components/dialogs/Embed.tsx @@ -8,12 +8,13 @@ import {EMBED_SCRIPT} from '#/lib/constants' import {niceDate} from '#/lib/strings/time' import {toShareUrl} from '#/lib/strings/url-helpers' import {atoms as a, useTheme} from '#/alf' +import {BottomSheetButton} from '#/components/BottomSheetButton' import * as Dialog from '#/components/Dialog' import * as TextField from '#/components/forms/TextField' import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' import {CodeBrackets_Stroke2_Corner0_Rounded as CodeBrackets} from '#/components/icons/CodeBrackets' import {Text} from '#/components/Typography' -import {Button, ButtonIcon, ButtonText} from '../Button' +import {ButtonIcon, ButtonText} from '../Button' type EmbedDialogProps = { control: Dialog.DialogControlProps @@ -117,7 +118,7 @@ function EmbedDialogInner({ /> - + diff --git a/src/components/dialogs/EmbedConsent.tsx b/src/components/dialogs/EmbedConsent.tsx index 3aa0f0b404..aee98e6b7c 100644 --- a/src/components/dialogs/EmbedConsent.tsx +++ b/src/components/dialogs/EmbedConsent.tsx @@ -10,8 +10,9 @@ import { } from '#/lib/strings/embed-player' import {useSetExternalEmbedPref} from '#/state/preferences' import {atoms as a, useBreakpoints, useTheme} from '#/alf' +import {BottomSheetButton} from '#/components/BottomSheetButton' import * as Dialog from '#/components/Dialog' -import {Button, ButtonText} from '../Button' +import {ButtonText} from '../Button' import {Text} from '../Typography' export function EmbedConsentDialog({ @@ -75,7 +76,7 @@ export function EmbedConsentDialog({ - - - + diff --git a/src/components/dialogs/GifSelect.tsx b/src/components/dialogs/GifSelect.tsx index 887cc30378..e270b2e1d6 100644 --- a/src/components/dialogs/GifSelect.tsx +++ b/src/components/dialogs/GifSelect.tsx @@ -20,12 +20,13 @@ import {ErrorScreen} from '#/view/com/util/error/ErrorScreen' import {ErrorBoundary} from '#/view/com/util/ErrorBoundary' import {ListMethods} from '#/view/com/util/List' import {atoms as a, useBreakpoints, useTheme} from '#/alf' +import {BottomSheetButton} from '#/components/BottomSheetButton' import * as Dialog from '#/components/Dialog' import * as TextField from '#/components/forms/TextField' import {useThrottledValue} from '#/components/hooks/useThrottledValue' import {ArrowLeft_Stroke2_Corner0_Rounded as Arrow} from '#/components/icons/Arrow' import {MagnifyingGlass2_Stroke2_Corner0_Rounded as Search} from '#/components/icons/MagnifyingGlass2' -import {Button, ButtonIcon, ButtonText} from '../Button' +import {ButtonIcon, ButtonText} from '../Button' import {ListFooter, ListMaybePlaceholder} from '../Lists' import {GifPreview} from './GifSelect.shared' @@ -148,7 +149,7 @@ function GifList({ /> {!gtMobile && isWeb && ( - + )} @@ -256,7 +257,7 @@ function DialogError({details}: {details?: string}) { )} details={details} /> - + ) } diff --git a/src/components/dialogs/MutedWords.tsx b/src/components/dialogs/MutedWords.tsx index daa18f94e7..bd9edab3d4 100644 --- a/src/components/dialogs/MutedWords.tsx +++ b/src/components/dialogs/MutedWords.tsx @@ -19,7 +19,8 @@ import { ViewStyleProp, web, } from '#/alf' -import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {useGlobalDialogsControlContext} from '#/components/dialogs/Context' import {Divider} from '#/components/Divider' @@ -315,7 +316,7 @@ function MutedWordsInner() { - + {error && ( @@ -518,7 +519,7 @@ function MutedWordRow({ )} - + ) diff --git a/src/components/dialogs/PostInteractionSettingsDialog.tsx b/src/components/dialogs/PostInteractionSettingsDialog.tsx index 93be838542..6d7cbf32f8 100644 --- a/src/components/dialogs/PostInteractionSettingsDialog.tsx +++ b/src/components/dialogs/PostInteractionSettingsDialog.tsx @@ -30,7 +30,8 @@ import { import {useAgent, useSession} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useTheme} from '#/alf' -import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {Divider} from '#/components/Divider' import * as Toggle from '#/components/forms/Toggle' @@ -432,7 +433,7 @@ export function PostInteractionSettingsForm({ - + ) } @@ -462,7 +463,7 @@ function Selectable({ }) { const t = useTheme() return ( - + ) } diff --git a/src/components/dialogs/Signin.tsx b/src/components/dialogs/Signin.tsx index d24f6af644..f348f08621 100644 --- a/src/components/dialogs/Signin.tsx +++ b/src/components/dialogs/Signin.tsx @@ -9,7 +9,8 @@ import {useCloseAllActiveElements} from '#/state/util' import {Logo} from '#/view/icons/Logo' import {Logotype} from '#/view/icons/Logotype' import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {useGlobalDialogsControlContext} from '#/components/dialogs/Context' import {Text} from '#/components/Typography' @@ -77,7 +78,7 @@ function SigninDialogInner({}: {control: Dialog.DialogOuterProps['control']}) { - + - + {isNative && } diff --git a/src/components/dms/MessagesNUX.tsx b/src/components/dms/MessagesNUX.tsx index 723696a04d..8ebd244e40 100644 --- a/src/components/dms/MessagesNUX.tsx +++ b/src/components/dms/MessagesNUX.tsx @@ -9,7 +9,8 @@ import {useProfileQuery} from '#/state/queries/profile' import {useSession} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useTheme, web} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as Toggle from '#/components/forms/Toggle' import {Message_Stroke2_Corner0_Rounded} from '#/components/icons/Message' @@ -156,7 +157,7 @@ function DialogInner({ - + diff --git a/src/components/dms/dialogs/SearchablePeopleList.tsx b/src/components/dms/dialogs/SearchablePeopleList.tsx index 17a7f43e57..5a4f64f88f 100644 --- a/src/components/dms/dialogs/SearchablePeopleList.tsx +++ b/src/components/dms/dialogs/SearchablePeopleList.tsx @@ -21,7 +21,7 @@ import {useSession} from '#/state/session' import {ListMethods} from '#/view/com/util/List' import {UserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, native, useTheme, web} from '#/alf' -import {Button} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' import * as Dialog from '#/components/Dialog' import {canBeMessaged} from '#/components/dms/util' import {useInteractionState} from '#/components/hooks/useInteractionState' @@ -254,7 +254,7 @@ export function SearchablePeopleList({ a.justify_center, {height: 32}, ]}> - + - {({hovered, pressed, focused}) => ( + {({pressed}) => ( )} - + ) } diff --git a/src/components/forms/DateField/index.tsx b/src/components/forms/DateField/index.tsx index 7546aec484..7e3d2a18f2 100644 --- a/src/components/forms/DateField/index.tsx +++ b/src/components/forms/DateField/index.tsx @@ -5,7 +5,8 @@ import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {atoms as a, useTheme} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {DateFieldProps} from '#/components/forms/DateField/types' import {toSimpleDateString} from '#/components/forms/DateField/utils' @@ -72,7 +73,7 @@ export function DateField({ accessibilityHint={accessibilityHint} /> - + diff --git a/src/components/intents/VerifyEmailIntentDialog.tsx b/src/components/intents/VerifyEmailIntentDialog.tsx index 9f3808020a..6576a5ecb8 100644 --- a/src/components/intents/VerifyEmailIntentDialog.tsx +++ b/src/components/intents/VerifyEmailIntentDialog.tsx @@ -5,7 +5,8 @@ import {useLingui} from '@lingui/react' import {useAgent, useSession} from '#/state/session' import {atoms as a} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {DialogControlProps} from '#/components/Dialog' import {useIntentDialogs} from '#/components/intents/IntentDialogs' @@ -106,7 +107,7 @@ function Inner({control}: {control: DialogControlProps}) { )} {status !== 'loading' ? ( - + {status === 'failure' ? ( - + ) : null} ) : null} diff --git a/src/components/moderation/LabelsOnMeDialog.tsx b/src/components/moderation/LabelsOnMeDialog.tsx index 389c722c87..33c0e63352 100644 --- a/src/components/moderation/LabelsOnMeDialog.tsx +++ b/src/components/moderation/LabelsOnMeDialog.tsx @@ -13,7 +13,8 @@ import {logger} from '#/logger' import {useAgent, useSession} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {InlineLinkText} from '#/components/Link' import {Text} from '#/components/Typography' @@ -139,7 +140,7 @@ function Label({ {!isSelfLabel && ( - + )} @@ -275,7 +276,7 @@ function AppealForm({ ? [a.flex_row, a.justify_between] : [{flexDirection: 'column-reverse'}, a.gap_sm] }> - - + ) diff --git a/src/screens/Onboarding/StepProfile/index.tsx b/src/screens/Onboarding/StepProfile/index.tsx index c6a39ab45e..0672d4fd37 100644 --- a/src/screens/Onboarding/StepProfile/index.tsx +++ b/src/screens/Onboarding/StepProfile/index.tsx @@ -30,6 +30,7 @@ import { PlaceholderCanvasRef, } from '#/screens/Onboarding/StepProfile/PlaceholderCanvas' import {atoms as a, useBreakpoints, useTheme} from '#/alf' +import {BottomSheetButton} from '#/components/BottomSheetButton' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {IconCircle} from '#/components/IconCircle' @@ -311,7 +312,7 @@ export function StepProfile() { /> - + diff --git a/src/view/com/auth/server-input/index.tsx b/src/view/com/auth/server-input/index.tsx index de7ed6d15b..0e9eb0d199 100644 --- a/src/view/com/auth/server-input/index.tsx +++ b/src/view/com/auth/server-input/index.tsx @@ -6,7 +6,8 @@ import {useLingui} from '@lingui/react' import {BSKY_SERVICE} from '#/lib/constants' import * as persisted from '#/state/persisted' import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as TextField from '#/components/forms/TextField' import * as ToggleButton from '#/components/forms/ToggleButton' @@ -124,7 +125,7 @@ export function ServerInputDialog({ {pdsAddressHistory.length > 0 && ( {pdsAddressHistory.map(uri => ( - + ))} )} @@ -160,7 +161,7 @@ export function ServerInputDialog({ - + diff --git a/src/view/com/composer/GifAltText.tsx b/src/view/com/composer/GifAltText.tsx index 1737fc29ca..a1b869c134 100644 --- a/src/view/com/composer/GifAltText.tsx +++ b/src/view/com/composer/GifAltText.tsx @@ -14,7 +14,8 @@ import { import {enforceLen} from '#/lib/strings/helpers' import {Gif} from '#/state/queries/tenor' import {atoms as a, native, useTheme} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as TextField from '#/components/forms/TextField' import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' @@ -154,7 +155,7 @@ function AltTextInner({ /> - + {/* below the text input to force tab order */} diff --git a/src/view/com/composer/photos/EditImageDialog.web.tsx b/src/view/com/composer/photos/EditImageDialog.web.tsx index 0afb83ed96..daffcc6080 100644 --- a/src/view/com/composer/photos/EditImageDialog.web.tsx +++ b/src/view/com/composer/photos/EditImageDialog.web.tsx @@ -12,7 +12,8 @@ import { manipulateImage, } from '#/state/gallery' import {atoms as a} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {Text} from '#/components/Typography' import {EditImageDialogProps} from './EditImageDialog' @@ -71,7 +72,7 @@ const EditImageInner = ({control, image, onChange}: EditImageDialogProps) => { - + ) diff --git a/src/view/com/composer/photos/ImageAltTextDialog.tsx b/src/view/com/composer/photos/ImageAltTextDialog.tsx index fc9c6c4931..9dcb877cd9 100644 --- a/src/view/com/composer/photos/ImageAltTextDialog.tsx +++ b/src/view/com/composer/photos/ImageAltTextDialog.tsx @@ -8,7 +8,8 @@ import {MAX_ALT_TEXT} from '#/lib/constants' import {isWeb} from '#/platform/detection' import {ComposerImage} from '#/state/gallery' import {atoms as a, useTheme} from '#/alf' -import {Button, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as TextField from '#/components/forms/TextField' import {Text} from '#/components/Typography' @@ -102,7 +103,7 @@ const ImageAltTextInner = ({ /> - + ) diff --git a/src/view/com/composer/videos/SubtitleDialog.tsx b/src/view/com/composer/videos/SubtitleDialog.tsx index d57c6740cf..c3d94bc0fb 100644 --- a/src/view/com/composer/videos/SubtitleDialog.tsx +++ b/src/view/com/composer/videos/SubtitleDialog.tsx @@ -10,6 +10,7 @@ import {LANGUAGES} from '#/locale/languages' import {isWeb} from '#/platform/detection' import {useLanguagePrefs} from '#/state/preferences' import {atoms as a, useTheme, web} from '#/alf' +import {BottomSheetButton} from '#/components/BottomSheetButton' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as TextField from '#/components/forms/TextField' @@ -164,7 +165,7 @@ function SubtitleDialogInner({ )} - + @@ -257,7 +258,7 @@ function SubtitleFileRow({ - + ) } diff --git a/src/view/com/util/post-ctrls/RepostButton.tsx b/src/view/com/util/post-ctrls/RepostButton.tsx index 14c869df8d..e697c02d80 100644 --- a/src/view/com/util/post-ctrls/RepostButton.tsx +++ b/src/view/com/util/post-ctrls/RepostButton.tsx @@ -7,6 +7,7 @@ import {POST_CTRL_HITSLOP} from '#/lib/constants' import {useHaptics} from '#/lib/haptics' import {useRequireAuth} from '#/state/session' import {atoms as a, useTheme} from '#/alf' +import {BottomSheetButton} from '#/components/BottomSheetButton' import {Button, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {CloseQuote_Stroke2_Corner1_Rounded as Quote} from '#/components/icons/Quote' @@ -92,7 +93,7 @@ let RepostButton = ({ - - + - + diff --git a/src/view/screens/Settings/DisableEmail2FADialog.tsx b/src/view/screens/Settings/DisableEmail2FADialog.tsx index bbc6902543..64a3061b11 100644 --- a/src/view/screens/Settings/DisableEmail2FADialog.tsx +++ b/src/view/screens/Settings/DisableEmail2FADialog.tsx @@ -9,7 +9,8 @@ import {useAgent, useSession} from '#/state/session' import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as TextField from '#/components/forms/TextField' import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock' @@ -108,7 +109,7 @@ export function DisableEmail2FADialog({ {stage === Stages.Email ? ( - - + ) : stage === Stages.ConfirmCode ? ( @@ -157,7 +158,7 @@ export function DisableEmail2FADialog({ - - + ) : undefined} diff --git a/src/view/screens/Settings/ExportCarDialog.tsx b/src/view/screens/Settings/ExportCarDialog.tsx index 3d21d7cb5e..caddc1c2ad 100644 --- a/src/view/screens/Settings/ExportCarDialog.tsx +++ b/src/view/screens/Settings/ExportCarDialog.tsx @@ -8,7 +8,8 @@ import {logger} from '#/logger' import {useAgent} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useTheme} from '#/alf' -import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {BottomSheetButton} from '#/components/BottomSheetButton' +import {ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {InlineLinkText} from '#/components/Link' import {Loader} from '#/components/Loader' @@ -68,7 +69,7 @@ export function ExportCarDialog({ - +