Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add basic visual feedback on Button interactions (#708)

* feat: add basic visual feedback on Button interaction

* Use a more efficient approach to providing visual feedback

* Fix some lint issues left over from another PR

---------

Co-authored-by: Simek <gosimek@gmail.com>

authored by

Paul Frazee
Simek
and committed by
GitHub
562faa76 41f3a055

+20 -6
+16 -1
src/view/com/util/forms/Button.tsx
··· 128 128 }, 129 129 }, 130 130 ) 131 + 131 132 const onPressWrapped = React.useCallback( 132 133 (event: Event) => { 133 134 event.stopPropagation() ··· 136 137 }, 137 138 [onPress], 138 139 ) 140 + 141 + const getStyle = React.useCallback( 142 + state => { 143 + const arr = [typeOuterStyle, styles.outer, style] 144 + if (state.pressed) { 145 + arr.push({opacity: 0.6}) 146 + } else if (state.hovered) { 147 + arr.push({opacity: 0.8}) 148 + } 149 + return arr 150 + }, 151 + [typeOuterStyle, style], 152 + ) 153 + 139 154 return ( 140 155 <Pressable 141 - style={[typeOuterStyle, styles.outer, style]} 156 + style={getStyle} 142 157 onPress={onPressWrapped} 143 158 testID={testID} 144 159 accessibilityRole="button"
+4 -5
src/view/shell/desktop/RightNav.tsx
··· 18 18 const store = useStores() 19 19 const pal = usePalette('default') 20 20 const mode = useColorSchemeStyle('Light', 'Dark') 21 - const otherMode = mode === 'Dark' ? 'Light' : 'Dark'; 21 + const otherMode = mode === 'Dark' ? 'Light' : 'Dark' 22 22 23 23 const onDarkmodePress = React.useCallback(() => { 24 24 store.shell.setDarkMode(!store.shell.darkMode) ··· 72 72 : 'Sets display to dark mode' 73 73 }> 74 74 <View style={[pal.viewLight, styles.darkModeToggleIcon]}> 75 - { 76 - mode === 'Dark' ? 75 + {mode === 'Dark' ? ( 77 76 <SunIcon size={18} style={pal.textLight} /> 78 - : 77 + ) : ( 79 78 <MoonIcon size={18} style={pal.textLight} /> 80 - } 79 + )} 81 80 </View> 82 81 <Text type="sm" style={pal.textLight}> 83 82 {otherMode} mode