diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-03-07 15:52:24 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 15:52:24 -0600 |
commit | e74f94bc72cdbb2282096b8d36677ba6655ab5be (patch) | |
tree | 997aa96761801e1cf23d69c455a2d1b1f5379e80 /src/view/com/util/PostMuted.tsx | |
parent | 2f3fc4fe4e799084799631323b73fc97820144c8 (diff) | |
download | voidsky-e74f94bc72cdbb2282096b8d36677ba6655ab5be.tar.zst |
Big batch of UI updates (#276)
* Replace react-native-root-toast with a custom toast that fits the visual style * Tune dark mode colors * Tune colors a bit more * Move the reply prompt to a fixed position in the footer * Fully hide muted posts but give a control to show anyway (close #270) * Improve thread rendering (better clarity on reply lines) * Add follower/following counts to side menu * Fix issues with display name overflows
Diffstat (limited to 'src/view/com/util/PostMuted.tsx')
-rw-r--r-- | src/view/com/util/PostMuted.tsx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/view/com/util/PostMuted.tsx b/src/view/com/util/PostMuted.tsx new file mode 100644 index 000000000..d8573bd56 --- /dev/null +++ b/src/view/com/util/PostMuted.tsx @@ -0,0 +1,50 @@ +import React from 'react' +import {StyleSheet, TouchableOpacity, View} from 'react-native' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {usePalette} from 'lib/hooks/usePalette' +import {Text} from './text/Text' + +export function PostMutedWrapper({ + isMuted, + children, +}: React.PropsWithChildren<{isMuted: boolean}>) { + const pal = usePalette('default') + const [override, setOverride] = React.useState(false) + if (!isMuted || override) { + return <>{children}</> + } + return ( + <View style={[styles.container, pal.view, pal.border]}> + <FontAwesomeIcon + icon={['far', 'eye-slash']} + style={[styles.icon, pal.text]} + /> + <Text type="md" style={pal.textLight}> + Post from an account you muted. + </Text> + <TouchableOpacity + style={styles.showBtn} + onPress={() => setOverride(true)}> + <Text type="md" style={pal.link}> + Show post + </Text> + </TouchableOpacity> + </View> + ) +} + +const styles = StyleSheet.create({ + container: { + flexDirection: 'row', + alignItems: 'center', + paddingVertical: 14, + paddingHorizontal: 18, + borderTopWidth: 1, + }, + icon: { + marginRight: 10, + }, + showBtn: { + marginLeft: 'auto', + }, +}) |