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