forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1/**
2 * Copyright (c) JOB TODAY S.A. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 */
8import {StyleSheet, TouchableOpacity, type ViewStyle} from 'react-native'
9import {SafeAreaView} from 'react-native-safe-area-context'
10import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
11import {msg} from '@lingui/macro'
12import {useLingui} from '@lingui/react'
13
14import {createHitslop} from '#/lib/constants'
15import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons'
16
17type Props = {
18 onRequestClose: () => void
19}
20
21const HIT_SLOP = createHitslop(16)
22
23const ImageDefaultHeader = ({onRequestClose}: Props) => {
24 const {_} = useLingui()
25 const enableSquareButtons = useEnableSquareButtons()
26 return (
27 <SafeAreaView style={styles.root}>
28 <TouchableOpacity
29 style={[
30 enableSquareButtons ? styles.closeButtonSquare : styles.closeButton,
31 styles.blurredBackground,
32 ]}
33 onPress={onRequestClose}
34 hitSlop={HIT_SLOP}
35 accessibilityRole="button"
36 accessibilityLabel={_(msg`Close image`)}
37 accessibilityHint={_(msg`Closes viewer for header image`)}
38 onAccessibilityEscape={onRequestClose}>
39 <FontAwesomeIcon icon="close" color={'#fff'} size={22} />
40 </TouchableOpacity>
41 </SafeAreaView>
42 )
43}
44
45const styles = StyleSheet.create({
46 root: {
47 alignItems: 'flex-end',
48 pointerEvents: 'box-none',
49 },
50 closeButton: {
51 marginRight: 10,
52 marginTop: 10,
53 width: 44,
54 height: 44,
55 alignItems: 'center',
56 justifyContent: 'center',
57 borderRadius: 22,
58 backgroundColor: '#00000077',
59 },
60 closeButtonSquare: {
61 marginRight: 10,
62 marginTop: 10,
63 width: 44,
64 height: 44,
65 alignItems: 'center',
66 justifyContent: 'center',
67 borderRadius: 11,
68 backgroundColor: '#00000077',
69 },
70 blurredBackground: {
71 backdropFilter: 'blur(10px)',
72 WebkitBackdropFilter: 'blur(10px)',
73 } as ViewStyle,
74})
75
76export default ImageDefaultHeader