Fix report dialog buttons on Android by adjusting styles

This commit is contained in:
Eric Bailey
2024-03-20 15:05:50 -05:00
parent 023e12bb4e
commit efefc7c414
3 changed files with 44 additions and 59 deletions
@@ -38,7 +38,7 @@ export function SelectLabelerView({
<Divider /> <Divider />
<View style={[a.gap_xs, {marginHorizontal: a.p_md.padding * -1}]}> <View style={[a.gap_sm]}>
{props.labelers.map(labeler => { {props.labelers.map(labeler => {
return ( return (
<Button <Button
@@ -63,17 +63,14 @@ function LabelerButton({
const {hovered, pressed} = useButtonContext() const {hovered, pressed} = useButtonContext()
const interacted = hovered || pressed const interacted = hovered || pressed
const styles = React.useMemo(() => {
return {
interacted: {
backgroundColor: t.palette.contrast_50,
},
}
}, [t])
return ( return (
<LabelingServiceCard.Outer <LabelingServiceCard.Outer
style={[a.p_md, a.rounded_sm, interacted && styles.interacted]}> style={[
a.p_md,
a.rounded_sm,
t.atoms.bg_contrast_25,
interacted && t.atoms.bg_contrast_50,
]}>
<LabelingServiceCard.Avatar avatar={labeler.creator.avatar} /> <LabelingServiceCard.Avatar avatar={labeler.creator.avatar} />
<LabelingServiceCard.Content> <LabelingServiceCard.Content>
<LabelingServiceCard.Title <LabelingServiceCard.Title
@@ -86,7 +86,7 @@ export function SelectReportOptionView({
<Divider /> <Divider />
<View style={[a.gap_sm, {marginHorizontal: a.p_md.padding * -1}]}> <View style={[a.gap_sm]}>
{reportOptions.map(reportOption => { {reportOptions.map(reportOption => {
return ( return (
<Button <Button
@@ -102,39 +102,37 @@ export function SelectReportOptionView({
})} })}
{(props.params.type === 'post' || props.params.type === 'account') && ( {(props.params.type === 'post' || props.params.type === 'account') && (
<View style={[a.pt_md, a.px_md]}> <View
<View style={[
a.flex_row,
a.align_center,
a.justify_between,
a.gap_lg,
a.p_md,
a.pl_lg,
a.rounded_md,
t.atoms.bg_contrast_900,
]}>
<Text
style={[ style={[
a.flex_row, a.flex_1,
a.align_center, t.atoms.text_inverted,
a.justify_between, a.italic,
a.gap_lg, a.leading_snug,
a.p_md,
a.pl_lg,
a.rounded_md,
t.atoms.bg_contrast_900,
]}> ]}>
<Text <Trans>Need to report a copyright violation?</Trans>
style={[ </Text>
a.flex_1, <Link
t.atoms.text_inverted, to={DMCA_LINK}
a.italic, label={_(msg`View details for reporting a copyright violation`)}
a.leading_snug, size="small"
]}> variant="solid"
<Trans>Need to report a copyright violation?</Trans> color="secondary">
</Text> <ButtonText>
<Link <Trans>View details</Trans>
to={DMCA_LINK} </ButtonText>
label={_(msg`View details for reporting a copyright violation`)} <ButtonIcon position="right" icon={SquareArrowTopRight} />
size="small" </Link>
variant="solid"
color="secondary">
<ButtonText>
<Trans>View details</Trans>
</ButtonText>
<ButtonIcon position="right" icon={SquareArrowTopRight} />
</Link>
</View>
</View> </View>
)} )}
</View> </View>
@@ -153,14 +151,6 @@ function ReportOptionButton({
const {hovered, pressed} = useButtonContext() const {hovered, pressed} = useButtonContext()
const interacted = hovered || pressed const interacted = hovered || pressed
const styles = React.useMemo(() => {
return {
interacted: {
backgroundColor: t.palette.contrast_50,
},
}
}, [t])
return ( return (
<View <View
style={[ style={[
@@ -171,7 +161,8 @@ function ReportOptionButton({
a.p_md, a.p_md,
a.rounded_md, a.rounded_md,
{paddingRight: 70}, {paddingRight: 70},
interacted && styles.interacted, t.atoms.bg_contrast_25,
interacted && t.atoms.bg_contrast_50,
]}> ]}>
<View style={[a.flex_1, a.gap_xs]}> <View style={[a.flex_1, a.gap_xs]}>
<Text style={[a.text_md, a.font_bold, t.atoms.text_contrast_medium]}> <Text style={[a.text_md, a.font_bold, t.atoms.text_contrast_medium]}>
@@ -188,12 +179,7 @@ function ReportOptionButton({
a.pr_md, a.pr_md,
{left: 'auto'}, {left: 'auto'},
]}> ]}>
<ChevronRight <ChevronRight size="md" fill={t.atoms.text_contrast_low.color} />
size="md"
fill={
hovered ? t.palette.primary_500 : t.atoms.text_contrast_low.color
}
/>
</View> </View>
</View> </View>
) )
+4 -2
View File
@@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import {View, Pressable} from 'react-native' import {View, Pressable} from 'react-native'
import {Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useMyLabelersQuery} from '#/state/queries/preferences' import {useMyLabelersQuery} from '#/state/queries/preferences'
import {ReportOption} from '#/lib/moderation/useReportOptions' import {ReportOption} from '#/lib/moderation/useReportOptions'
@@ -29,6 +30,7 @@ export function ReportDialog(props: ReportDialogProps) {
} }
function ReportDialogInner(props: ReportDialogProps) { function ReportDialogInner(props: ReportDialogProps) {
const {_} = useLingui()
const { const {
isLoading: isLabelerLoading, isLoading: isLabelerLoading,
data: labelers, data: labelers,
@@ -38,7 +40,7 @@ function ReportDialogInner(props: ReportDialogProps) {
return ( return (
<Dialog.ScrollableInner <Dialog.ScrollableInner
label="Report Dialog" label={_(msg`Report dialog`)}
keyboardDismissMode="interactive"> keyboardDismissMode="interactive">
{isLoading ? ( {isLoading ? (
<View style={[a.align_center, {height: 100}]}> <View style={[a.align_center, {height: 100}]}>