revert all the changes that are not needed'

This commit is contained in:
Hailey
2024-10-02 17:13:42 -07:00
parent bb33aa0106
commit 67e4d775c9
8 changed files with 24 additions and 42 deletions
-12
View File
@@ -1,12 +0,0 @@
import React from 'react'
import {Button, ButtonProps} from '#/components/Button'
import {NormalizedRNGHPressable} from '#/components/NormalizedRNGHPressable'
export function BottomSheetButton({children, ...rest}: ButtonProps) {
return (
<Button {...rest} Component={NormalizedRNGHPressable}>
{children}
</Button>
)
}
-3
View File
@@ -1,3 +0,0 @@
import {Button as BottomSheetButton} from '#/components/Button'
export {BottomSheetButton}
+1
View File
@@ -103,6 +103,7 @@ export function Outer({
const context = React.useMemo( const context = React.useMemo(
() => ({ () => ({
close, close,
insideDialog: true,
}), }),
[close], [close],
) )
+2 -3
View File
@@ -23,7 +23,6 @@ import {shouldClickOpenNewTab} from '#/platform/urls'
import {useModalControls} from '#/state/modals' import {useModalControls} from '#/state/modals'
import {useOpenLink} from '#/state/preferences/in-app-browser' import {useOpenLink} from '#/state/preferences/in-app-browser'
import {atoms as a, flatten, TextStyleProp, useTheme, web} from '#/alf' import {atoms as a, flatten, TextStyleProp, useTheme, web} from '#/alf'
import {BottomSheetButton} from '#/components/BottomSheetButton'
import {Button, ButtonProps} from '#/components/Button' import {Button, ButtonProps} from '#/components/Button'
import {useInteractionState} from '#/components/hooks/useInteractionState' import {useInteractionState} from '#/components/hooks/useInteractionState'
import {Text, TextProps} from '#/components/Typography' import {Text, TextProps} from '#/components/Typography'
@@ -258,7 +257,7 @@ export function BottomSheetLink({
}) })
return ( return (
<BottomSheetButton <Button
{...rest} {...rest}
style={[a.justify_start, flatten(rest.style)]} style={[a.justify_start, flatten(rest.style)]}
role="link" role="link"
@@ -277,7 +276,7 @@ export function BottomSheetLink({
}, },
})}> })}>
{children} {children}
</BottomSheetButton> </Button>
) )
} }
+9 -11
View File
@@ -1,13 +1,11 @@
import React from 'react' import React from 'react'
import {View} from 'react-native' import {GestureResponderEvent, View} from 'react-native'
import {PressableEvent} from 'react-native-gesture-handler/lib/typescript/components/Pressable/PressableProps'
import {msg} from '@lingui/macro' import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {isNative} from '#/platform/detection' import {isNative} from '#/platform/detection'
import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {BottomSheetButton} from '#/components/BottomSheetButton' import {Button, ButtonColor, ButtonText} from '#/components/Button'
import {ButtonColor, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -123,14 +121,14 @@ export function Cancel({
}, [close]) }, [close])
return ( return (
<BottomSheetButton <Button
variant="solid" variant="solid"
color="secondary" color="secondary"
size={gtMobile ? 'small' : 'large'} size={gtMobile ? 'small' : 'large'}
label={cta || _(msg`Cancel`)} label={cta || _(msg`Cancel`)}
onPress={onPress}> onPress={onPress}>
<ButtonText>{cta || _(msg`Cancel`)}</ButtonText> <ButtonText>{cta || _(msg`Cancel`)}</ButtonText>
</BottomSheetButton> </Button>
) )
} }
@@ -147,7 +145,7 @@ export function Action({
* Note: The dialog will close automatically when the action is pressed, you * Note: The dialog will close automatically when the action is pressed, you
* should NOT close the dialog as a side effect of this method. * should NOT close the dialog as a side effect of this method.
*/ */
onPress: (e: PressableEvent) => void onPress: (e: GestureResponderEvent) => void
color?: ButtonColor color?: ButtonColor
/** /**
* Optional i18n string. If undefined, it will default to "Confirm". * Optional i18n string. If undefined, it will default to "Confirm".
@@ -159,14 +157,14 @@ export function Action({
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
const {close} = Dialog.useDialogContext() const {close} = Dialog.useDialogContext()
const handleOnPress = React.useCallback( const handleOnPress = React.useCallback(
(e: PressableEvent) => { (e: GestureResponderEvent) => {
close(() => onPress?.(e)) close(() => onPress?.(e))
}, },
[close, onPress], [close, onPress],
) )
return ( return (
<BottomSheetButton <Button
variant="solid" variant="solid"
color={color} color={color}
size={gtMobile ? 'small' : 'large'} size={gtMobile ? 'small' : 'large'}
@@ -174,7 +172,7 @@ export function Action({
onPress={handleOnPress} onPress={handleOnPress}
testID={testID}> testID={testID}>
<ButtonText>{cta || _(msg`Confirm`)}</ButtonText> <ButtonText>{cta || _(msg`Confirm`)}</ButtonText>
</BottomSheetButton> </Button>
) )
} }
@@ -201,7 +199,7 @@ export function Basic({
* Note: The dialog will close automatically when the action is pressed, you * Note: The dialog will close automatically when the action is pressed, you
* should NOT close the dialog as a side effect of this method. * should NOT close the dialog as a side effect of this method.
*/ */
onConfirm: (e: PressableEvent) => void onConfirm: (e: GestureResponderEvent) => void
confirmButtonColor?: ButtonColor confirmButtonColor?: ButtonColor
showCancel?: boolean showCancel?: boolean
withoutPortal?: boolean withoutPortal?: boolean
@@ -6,8 +6,7 @@ import {useLingui} from '@lingui/react'
import {getLabelingServiceTitle} from '#/lib/moderation' import {getLabelingServiceTitle} from '#/lib/moderation'
import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {BottomSheetButton} from '#/components/BottomSheetButton' import {Button, useButtonContext} from '#/components/Button'
import {useButtonContext} from '#/components/Button'
import {Divider} from '#/components/Divider' import {Divider} from '#/components/Divider'
import * as LabelingServiceCard from '#/components/LabelingServiceCard' import * as LabelingServiceCard from '#/components/LabelingServiceCard'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -39,12 +38,12 @@ export function SelectLabelerView({
<View style={[a.gap_sm]}> <View style={[a.gap_sm]}>
{props.labelers.map(labeler => { {props.labelers.map(labeler => {
return ( return (
<BottomSheetButton <Button
key={labeler.creator.did} key={labeler.creator.did}
label={_(msg`Send report to ${labeler.creator.displayName}`)} label={_(msg`Send report to ${labeler.creator.displayName}`)}
onPress={() => props.onSelectLabeler(labeler.creator.did)}> onPress={() => props.onSelectLabeler(labeler.creator.did)}>
<LabelerButton labeler={labeler} /> <LabelerButton labeler={labeler} />
</BottomSheetButton> </Button>
) )
})} })}
</View> </View>
+2 -1
View File
@@ -1,5 +1,6 @@
import React from 'react' import React from 'react'
import {Pressable, ScrollView, View} from 'react-native' import {Pressable, View} from 'react-native'
import {ScrollView} from 'react-native-gesture-handler'
import {msg, Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
@@ -13,9 +13,8 @@ import {logger} from '#/logger'
import {useAgent, useSession} from '#/state/session' import {useAgent, useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast' import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {BottomSheetButton} from '#/components/BottomSheetButton'
import {BottomSheetInlineLinkText} from '#/components/BottomSheetLink' import {BottomSheetInlineLinkText} from '#/components/BottomSheetLink'
import {ButtonIcon, ButtonText} from '#/components/Button' import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {InlineLinkText} from '#/components/Link' import {InlineLinkText} from '#/components/Link'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -141,7 +140,7 @@ function Label({
</View> </View>
{!isSelfLabel && ( {!isSelfLabel && (
<View> <View>
<BottomSheetButton <Button
variant="solid" variant="solid"
color="secondary" color="secondary"
size="small" size="small"
@@ -150,7 +149,7 @@ function Label({
<ButtonText> <ButtonText>
<Trans>Appeal</Trans> <Trans>Appeal</Trans>
</ButtonText> </ButtonText>
</BottomSheetButton> </Button>
</View> </View>
)} )}
</View> </View>
@@ -279,7 +278,7 @@ function AppealForm({
? [a.flex_row, a.justify_between] ? [a.flex_row, a.justify_between]
: [{flexDirection: 'column-reverse'}, a.gap_sm] : [{flexDirection: 'column-reverse'}, a.gap_sm]
}> }>
<BottomSheetButton <Button
testID="backBtn" testID="backBtn"
variant="solid" variant="solid"
color="secondary" color="secondary"
@@ -287,8 +286,8 @@ function AppealForm({
onPress={onPressBack} onPress={onPressBack}
label={_(msg`Back`)}> label={_(msg`Back`)}>
<ButtonText>{_(msg`Back`)}</ButtonText> <ButtonText>{_(msg`Back`)}</ButtonText>
</BottomSheetButton> </Button>
<BottomSheetButton <Button
testID="submitBtn" testID="submitBtn"
variant="solid" variant="solid"
color="primary" color="primary"
@@ -297,7 +296,7 @@ function AppealForm({
label={_(msg`Submit`)}> label={_(msg`Submit`)}>
<ButtonText>{_(msg`Submit`)}</ButtonText> <ButtonText>{_(msg`Submit`)}</ButtonText>
{isPending && <ButtonIcon icon={Loader} />} {isPending && <ButtonIcon icon={Loader} />}
</BottomSheetButton> </Button>
</View> </View>
</> </>
) )