about summary refs log tree commit diff
path: root/src/view/com/modals/AltImageRead.tsx
diff options
context:
space:
mode:
authorOllie H <renahlee@outlook.com>2023-05-01 11:59:17 -0700
committerGitHub <noreply@github.com>2023-05-01 13:59:17 -0500
commitdbb3c5c15524c517291356a4918d043348906aad (patch)
tree8b7a38c2d5c56c34b43dcbddccf640e8c9a52ad3 /src/view/com/modals/AltImageRead.tsx
parent0ec98c77ef65ff74e83b314d8eed9ef9b07d47d3 (diff)
downloadvoidsky-dbb3c5c15524c517291356a4918d043348906aad.tar.zst
Image alt text view modal (#551)
* Image alt text view modal

* Minor style tweaks

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/modals/AltImageRead.tsx')
-rw-r--r--src/view/com/modals/AltImageRead.tsx75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/view/com/modals/AltImageRead.tsx b/src/view/com/modals/AltImageRead.tsx
new file mode 100644
index 000000000..e7b4797ee
--- /dev/null
+++ b/src/view/com/modals/AltImageRead.tsx
@@ -0,0 +1,75 @@
+import React, {useCallback} from 'react'
+import {StyleSheet, View} from 'react-native'
+import {usePalette} from 'lib/hooks/usePalette'
+import {gradients, s} from 'lib/styles'
+import {Text} from '../util/text/Text'
+import {TouchableOpacity} from 'react-native-gesture-handler'
+import LinearGradient from 'react-native-linear-gradient'
+import {useStores} from 'state/index'
+import {isDesktopWeb} from 'platform/detection'
+
+export const snapPoints = ['70%']
+
+interface Props {
+  altText: string
+}
+
+export function Component({altText}: Props) {
+  const pal = usePalette('default')
+  const store = useStores()
+
+  const onPress = useCallback(() => {
+    store.shell.closeModal()
+  }, [store])
+
+  return (
+    <View
+      testID="altTextImageModal"
+      style={[pal.view, styles.container, s.flex1]}>
+      <Text style={[styles.title, pal.text]}>Image description</Text>
+      <View style={[styles.text, pal.viewLight]}>
+        <Text style={pal.text}>{altText}</Text>
+      </View>
+      <TouchableOpacity testID="altTextImageSaveBtn" onPress={onPress}>
+        <LinearGradient
+          colors={[gradients.blueLight.start, gradients.blueLight.end]}
+          start={{x: 0, y: 0}}
+          end={{x: 1, y: 1}}
+          style={[styles.button]}>
+          <Text type="button-lg" style={[s.white, s.bold]}>
+            Done
+          </Text>
+        </LinearGradient>
+      </TouchableOpacity>
+    </View>
+  )
+}
+
+const styles = StyleSheet.create({
+  container: {
+    gap: 18,
+    paddingVertical: isDesktopWeb ? 0 : 18,
+    paddingHorizontal: isDesktopWeb ? 0 : 12,
+    height: '100%',
+    width: '100%',
+  },
+  title: {
+    textAlign: 'center',
+    fontWeight: 'bold',
+    fontSize: 24,
+  },
+  text: {
+    borderRadius: 5,
+    marginVertical: 18,
+    paddingHorizontal: 18,
+    paddingVertical: 16,
+  },
+  button: {
+    flexDirection: 'row',
+    alignItems: 'center',
+    justifyContent: 'center',
+    width: '100%',
+    borderRadius: 32,
+    padding: 10,
+  },
+})