Composer - unbork web (#4344)

* reduce side gap + add overflow hidden

also remove the animations since they don't appear in prod, and are kinda broken

* removed fixed height to fix alt text
zio/stable
Samuel Newman 2024-06-04 12:58:09 +03:00 committed by GitHub
parent d032734278
commit d918f8dc2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 31 deletions

View File

@ -117,7 +117,7 @@ export const ComposePost = observer(function ComposePost({
const {closeComposer} = useComposerControls() const {closeComposer} = useComposerControls()
const {track} = useAnalytics() const {track} = useAnalytics()
const pal = usePalette('default') const pal = usePalette('default')
const {isTabletOrDesktop, isMobile} = useWebMediaQueries() const {isMobile} = useWebMediaQueries()
const {_} = useLingui() const {_} = useLingui()
const requireAltTextEnabled = useRequireAltTextEnabled() const requireAltTextEnabled = useRequireAltTextEnabled()
const langPrefs = useLanguagePrefs() const langPrefs = useLanguagePrefs()
@ -400,12 +400,7 @@ export const ComposePost = observer(function ComposePost({
style={[a.flex_1, viewStyles]} style={[a.flex_1, viewStyles]}
aria-modal aria-modal
accessibilityViewIsModal> accessibilityViewIsModal>
<Animated.View <Animated.View style={topBarAnimatedStyle}>
style={[
styles.topbar,
topBarAnimatedStyle,
isWeb && isTabletOrDesktop && styles.topbarDesktop,
]}>
<View style={styles.topbarInner}> <View style={styles.topbarInner}>
<TouchableOpacity <TouchableOpacity
testID="composerDiscardButton" testID="composerDiscardButton"
@ -727,10 +722,6 @@ function useAnimatedBorders() {
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
topbar: {},
topbarDesktop: {
height: 50,
},
topbarInner: { topbarInner: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',

View File

@ -1,22 +1,20 @@
import React from 'react' import React from 'react'
import {StyleSheet, View} from 'react-native' import {StyleSheet, View} from 'react-native'
import Animated, {FadeIn, FadeInDown, FadeOut} from 'react-native-reanimated'
import {useWebBodyScrollLock} from '#/lib/hooks/useWebBodyScrollLock' import {useWebBodyScrollLock} from '#/lib/hooks/useWebBodyScrollLock'
import {usePalette} from 'lib/hooks/usePalette'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
import {useComposerState} from 'state/shell/composer' import {useComposerState} from 'state/shell/composer'
import { import {
EmojiPicker, EmojiPicker,
EmojiPickerState, EmojiPickerState,
} from 'view/com/composer/text-input/web/EmojiPicker.web' } from 'view/com/composer/text-input/web/EmojiPicker.web'
import {useBreakpoints, useTheme} from '#/alf'
import {ComposePost} from '../com/composer/Composer' import {ComposePost} from '../com/composer/Composer'
const BOTTOM_BAR_HEIGHT = 61 const BOTTOM_BAR_HEIGHT = 61
export function Composer({}: {winHeight: number}) { export function Composer({}: {winHeight: number}) {
const pal = usePalette('default') const t = useTheme()
const {isMobile} = useWebMediaQueries() const {gtMobile} = useBreakpoints()
const state = useComposerState() const state = useComposerState()
const isActive = !!state const isActive = !!state
useWebBodyScrollLock(isActive) useWebBodyScrollLock(isActive)
@ -49,20 +47,13 @@ export function Composer({}: {winHeight: number}) {
} }
return ( return (
<Animated.View <View style={styles.mask} aria-modal accessibilityViewIsModal>
style={styles.mask} <View
aria-modal
accessibilityViewIsModal
entering={FadeIn.duration(100)}
exiting={FadeOut}>
<Animated.View
entering={FadeInDown.duration(150)}
exiting={FadeOut}
style={[ style={[
styles.container, styles.container,
isMobile && styles.containerMobile, !gtMobile && styles.containerMobile,
pal.view, t.atoms.bg,
pal.border, t.atoms.border_contrast_medium,
]}> ]}>
<ComposePost <ComposePost
replyTo={state.replyTo} replyTo={state.replyTo}
@ -72,9 +63,9 @@ export function Composer({}: {winHeight: number}) {
openPicker={onOpenPicker} openPicker={onOpenPicker}
text={state.text} text={state.text}
/> />
</Animated.View> </View>
<EmojiPicker state={pickerState} close={onClosePicker} /> <EmojiPicker state={pickerState} close={onClosePicker} />
</Animated.View> </View>
) )
} }
@ -94,12 +85,12 @@ const styles = StyleSheet.create({
maxWidth: 600, maxWidth: 600,
width: '100%', width: '100%',
paddingVertical: 0, paddingVertical: 0,
paddingHorizontal: 2,
borderRadius: 8, borderRadius: 8,
marginBottom: 0, marginBottom: 0,
borderWidth: 1, borderWidth: 1,
// @ts-ignore web only // @ts-ignore web only
maxHeight: 'calc(100% - (40px * 2))', maxHeight: 'calc(100% - (40px * 2))',
overflow: 'hidden',
}, },
containerMobile: { containerMobile: {
borderRadius: 0, borderRadius: 0,