about summary refs log tree commit diff
path: root/src/view/com/util/load-latest/LoadLatestBtn.web.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/LoadLatestBtn.web.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/LoadLatestBtn.web.tsx')
-rw-r--r--src/view/com/util/load-latest/LoadLatestBtn.web.tsx58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/view/com/util/load-latest/LoadLatestBtn.web.tsx b/src/view/com/util/load-latest/LoadLatestBtn.web.tsx
new file mode 100644
index 000000000..22a8fbada
--- /dev/null
+++ b/src/view/com/util/load-latest/LoadLatestBtn.web.tsx
@@ -0,0 +1,58 @@
+import React from 'react'
+import {StyleSheet, TouchableOpacity} from 'react-native'
+import {Text} from '../text/Text'
+import {usePalette} from 'lib/hooks/usePalette'
+import {UpIcon} from 'lib/icons'
+import {LoadLatestBtn as LoadLatestBtnMobile} from './LoadLatestBtnMobile'
+import {isMobileWeb} from 'platform/detection'
+
+const HITSLOP = {left: 20, top: 20, right: 20, bottom: 20}
+
+export const LoadLatestBtn = ({
+  onPress,
+  label,
+}: {
+  onPress: () => void
+  label: string
+}) => {
+  const pal = usePalette('default')
+  if (isMobileWeb) {
+    return <LoadLatestBtnMobile onPress={onPress} label={label} />
+  }
+  return (
+    <TouchableOpacity
+      style={[pal.view, pal.borderDark, styles.loadLatest]}
+      onPress={onPress}
+      hitSlop={HITSLOP}>
+      <Text type="md-bold" style={pal.text}>
+        <UpIcon size={16} strokeWidth={1} style={[pal.text, styles.icon]} />
+        Load new {label}
+      </Text>
+    </TouchableOpacity>
+  )
+}
+
+const styles = StyleSheet.create({
+  loadLatest: {
+    flexDirection: 'row',
+    position: 'absolute',
+    left: '50vw',
+    // @ts-ignore web only -prf
+    transform: 'translateX(-50%)',
+    top: 30,
+    shadowColor: '#000',
+    shadowOpacity: 0.2,
+    shadowOffset: {width: 0, height: 2},
+    shadowRadius: 4,
+    paddingLeft: 20,
+    paddingRight: 24,
+    paddingVertical: 10,
+    borderRadius: 30,
+    borderWidth: 1,
+  },
+  icon: {
+    position: 'relative',
+    top: 2,
+    marginRight: 5,
+  },
+})