mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import React from 'react'
2import {StyleSheet, View} from 'react-native'
3
4import {isTouchDevice} from '#/lib/browser'
5import {useTheme, ViewStyleProp} from '#/alf'
6
7export function SubtleWebHover({
8 style,
9 hover,
10}: ViewStyleProp & {hover: boolean}) {
11 const t = useTheme()
12 if (isTouchDevice) {
13 return null
14 }
15 let opacity: number
16 switch (t.name) {
17 case 'dark':
18 opacity = 0.4
19 break
20 case 'dim':
21 opacity = 0.45
22 break
23 case 'light':
24 opacity = 0.5
25 break
26 }
27 return (
28 <View
29 style={[
30 t.atoms.bg_contrast_25,
31 styles.container,
32 {opacity: hover ? opacity : 0},
33 style,
34 ]}
35 />
36 )
37}
38
39const styles = StyleSheet.create({
40 container: {
41 position: 'absolute',
42 left: 0,
43 right: 0,
44 bottom: 0,
45 top: 0,
46 pointerEvents: 'none',
47 // @ts-ignore web only
48 transition: '0.15s ease-in-out opacity',
49 },
50})