Composer - fix divider when replying to someone (#4279)

* move replyto border to beneath

* use hairline width for consistency

* fix border colors
zio/stable
Samuel Newman 2024-05-30 14:34:30 +03:00 committed by GitHub
parent cd497a3974
commit a72f55a11f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 7 deletions

View File

@ -183,7 +183,9 @@ export const ComposePost = observer(function ComposePost({
[0, 1], [0, 1],
[ [
'transparent', 'transparent',
isWeb ? t.palette.contrast_100 : t.palette.contrast_400, isWeb
? t.atoms.border_contrast_low.borderColor
: t.atoms.border_contrast_high.borderColor,
], ],
), ),
} }

View File

@ -10,16 +10,17 @@ import {
import {msg} from '@lingui/macro' import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {usePalette} from 'lib/hooks/usePalette' import {isWeb} from '#/platform/detection'
import {sanitizeDisplayName} from 'lib/strings/display-names' import {sanitizeDisplayName} from 'lib/strings/display-names'
import {sanitizeHandle} from 'lib/strings/handles' import {sanitizeHandle} from 'lib/strings/handles'
import {ComposerOptsPostRef} from 'state/shell/composer' import {ComposerOptsPostRef} from 'state/shell/composer'
import {QuoteEmbed} from 'view/com/util/post-embeds/QuoteEmbed' import {QuoteEmbed} from 'view/com/util/post-embeds/QuoteEmbed'
import {Text} from 'view/com/util/text/Text' import {Text} from 'view/com/util/text/Text'
import {PreviewableUserAvatar} from 'view/com/util/UserAvatar' import {PreviewableUserAvatar} from 'view/com/util/UserAvatar'
import {useTheme} from '#/alf'
export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) { export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
const pal = usePalette('default') const t = useTheme()
const {_} = useLingui() const {_} = useLingui()
const {embed} = replyTo const {embed} = replyTo
@ -75,7 +76,10 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
return ( return (
<Pressable <Pressable
style={[pal.border, styles.replyToLayout]} style={[
isWeb ? t.atoms.border_contrast_low : t.atoms.border_contrast_high,
styles.replyToLayout,
]}
onPress={onPress} onPress={onPress}
accessibilityRole="button" accessibilityRole="button"
accessibilityLabel={_( accessibilityLabel={_(
@ -91,7 +95,7 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
type={replyTo.author.associated?.labeler ? 'labeler' : 'user'} type={replyTo.author.associated?.labeler ? 'labeler' : 'user'}
/> />
<View style={styles.replyToPost}> <View style={styles.replyToPost}>
<Text type="xl-medium" style={[pal.text]}> <Text type="xl-medium" style={t.atoms.text}>
{sanitizeDisplayName( {sanitizeDisplayName(
replyTo.author.displayName || sanitizeHandle(replyTo.author.handle), replyTo.author.displayName || sanitizeHandle(replyTo.author.handle),
)} )}
@ -100,7 +104,7 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
<View style={styles.replyToText}> <View style={styles.replyToText}>
<Text <Text
type="post-text" type="post-text"
style={pal.text} style={t.atoms.text}
numberOfLines={!showFull ? 6 : undefined}> numberOfLines={!showFull ? 6 : undefined}>
{replyTo.text} {replyTo.text}
</Text> </Text>
@ -218,7 +222,7 @@ const styles = StyleSheet.create({
replyToLayout: { replyToLayout: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'flex-start', alignItems: 'flex-start',
borderTopWidth: 1, borderBottomWidth: StyleSheet.hairlineWidth,
paddingTop: 16, paddingTop: 16,
paddingBottom: 16, paddingBottom: 16,
}, },