diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-03-12 00:21:48 +0000 |
---|---|---|
committer | Samuel Newman <mozzius@protonmail.com> | 2024-03-12 00:21:48 +0000 |
commit | f3619cf9f9f74fb744bfdf074bbc470d8118dc4a (patch) | |
tree | 4d0c79f64e19e6c2ab6efae6cb31a02561c16629 /src | |
parent | c1c7a55fd5849c66032692533681a5c9317cb6d3 (diff) | |
download | voidsky-f3619cf9f9f74fb744bfdf074bbc470d8118dc4a.tar.zst |
move button inline if viewport is small (vertically)
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/util/load-latest/LoadLatestBtn.tsx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/view/com/util/load-latest/LoadLatestBtn.tsx b/src/view/com/util/load-latest/LoadLatestBtn.tsx index 5fad11760..41a1f1067 100644 --- a/src/view/com/util/load-latest/LoadLatestBtn.tsx +++ b/src/view/com/util/load-latest/LoadLatestBtn.tsx @@ -11,6 +11,7 @@ const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity) import {isWeb} from 'platform/detection' import {useSession} from 'state/session' +import {useMediaQuery} from 'react-responsive' export function LoadLatestBtn({ onPress, @@ -26,6 +27,9 @@ export function LoadLatestBtn({ const {isDesktop, isTablet, isMobile, isTabletOrMobile} = useWebMediaQueries() const {fabMinimalShellTransform} = useMinimalShellMode() + // move button inline if it starts overlapping the left nav + const isTallViewport = useMediaQuery({minHeight: 700}) + // Adjust height of the fab if we have a session only on mobile web. If we don't have a session, we want to adjust // it on both tablet and mobile since we are showing the bottom bar (see createNativeStackNavigatorWithAuth) const showBottomBar = hasSession ? isMobile : isTabletOrMobile @@ -34,8 +38,11 @@ export function LoadLatestBtn({ <AnimatedTouchableOpacity style={[ styles.loadLatest, - isDesktop && styles.loadLatestDesktop, - isTablet && styles.loadLatestTablet, + isDesktop && + (isTallViewport + ? styles.loadLatestOutOfLine + : styles.loadLatestInline), + isTablet && styles.loadLatestInline, pal.borderDark, pal.view, showBottomBar && fabMinimalShellTransform, @@ -65,11 +72,11 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, - loadLatestTablet: { + loadLatestInline: { // @ts-ignore web only left: 'calc(50vw - 282px)', }, - loadLatestDesktop: { + loadLatestOutOfLine: { // @ts-ignore web only left: 'calc(50vw - 382px)', }, |