about summary refs log tree commit diff
path: root/src/view/com/util/load-latest/LoadLatestBtnMobile.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-04-15 10:15:30 -0700
committerGitHub <noreply@github.com>2023-04-15 10:15:30 -0700
commit91fadadb5848404bc47b69879bbc38a9011a0c62 (patch)
tree57f6b085b2a81bb33441c7107bd02b89187aec8e /src/view/com/util/load-latest/LoadLatestBtnMobile.tsx
parenta79dcd3d3890b2b705cb1e687cf0f31e109fbf74 (diff)
downloadvoidsky-91fadadb5848404bc47b69879bbc38a9011a0c62.tar.zst
Fix web home feed sizing and related issues (close #432) (#475)
* Fix web home feed sizing (close #432)

* Fix lint

* Fix positioning of profile not found error

* Fix load latest on mobile

* Fix overflow issues on mobile web (visible in postthread)

* Fix bottom pad on mobile web

* Remove old comment
Diffstat (limited to 'src/view/com/util/load-latest/LoadLatestBtnMobile.tsx')
-rw-r--r--src/view/com/util/load-latest/LoadLatestBtnMobile.tsx59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/view/com/util/load-latest/LoadLatestBtnMobile.tsx b/src/view/com/util/load-latest/LoadLatestBtnMobile.tsx
new file mode 100644
index 000000000..75a812760
--- /dev/null
+++ b/src/view/com/util/load-latest/LoadLatestBtnMobile.tsx
@@ -0,0 +1,59 @@
+import React from 'react'
+import {StyleSheet, TouchableOpacity} from 'react-native'
+import {observer} from 'mobx-react-lite'
+import LinearGradient from 'react-native-linear-gradient'
+import {useSafeAreaInsets} from 'react-native-safe-area-context'
+import {Text} from '../text/Text'
+import {colors, gradients} from 'lib/styles'
+import {clamp} from 'lodash'
+import {useStores} from 'state/index'
+
+const HITSLOP = {left: 20, top: 20, right: 20, bottom: 20}
+
+export const LoadLatestBtn = observer(
+  ({onPress, label}: {onPress: () => void; label: string}) => {
+    const store = useStores()
+    const safeAreaInsets = useSafeAreaInsets()
+    return (
+      <TouchableOpacity
+        style={[
+          styles.loadLatest,
+          !store.shell.minimalShellMode && {
+            bottom: 60 + clamp(safeAreaInsets.bottom, 15, 30),
+          },
+        ]}
+        onPress={onPress}
+        hitSlop={HITSLOP}>
+        <LinearGradient
+          colors={[gradients.blueLight.start, gradients.blueLight.end]}
+          start={{x: 0, y: 0}}
+          end={{x: 1, y: 1}}
+          style={styles.loadLatestInner}>
+          <Text type="md-bold" style={styles.loadLatestText}>
+            Load new {label}
+          </Text>
+        </LinearGradient>
+      </TouchableOpacity>
+    )
+  },
+)
+
+const styles = StyleSheet.create({
+  loadLatest: {
+    position: 'absolute',
+    left: 20,
+    bottom: 35,
+    shadowColor: '#000',
+    shadowOpacity: 0.3,
+    shadowOffset: {width: 0, height: 1},
+  },
+  loadLatestInner: {
+    flexDirection: 'row',
+    paddingHorizontal: 14,
+    paddingVertical: 10,
+    borderRadius: 30,
+  },
+  loadLatestText: {
+    color: colors.white,
+  },
+})