about summary refs log tree commit diff
path: root/src/view/com/modals/Confirm.tsx
diff options
context:
space:
mode:
authorOllie H <renahlee@outlook.com>2023-05-02 21:00:18 -0700
committerGitHub <noreply@github.com>2023-05-02 23:00:18 -0500
commit95f8360d19938d00aaf9036a76616a7b82093703 (patch)
tree30c405a73df2d3f2cfeda6e4f4d044e5903ac12c /src/view/com/modals/Confirm.tsx
parentaf905947bc4835cfff6f748851c95ac75cb7fb23 (diff)
downloadvoidsky-95f8360d19938d00aaf9036a76616a7b82093703.tar.zst
Add keyboard shortcuts: new, escape, and hard break (#552)
* Add keyboard shortcuts: new, escape, and hard break

* Add preferences modal

* Remove code accidentally re-added due to rebase

* Fix incorrect copy and lint

* Put stuff back so diffs are clearer

* Re-add invite codes to settings

* Address comments

* Tune the copy

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/modals/Confirm.tsx')
-rw-r--r--src/view/com/modals/Confirm.tsx27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/view/com/modals/Confirm.tsx b/src/view/com/modals/Confirm.tsx
index c508c2d3a..11e1a6334 100644
--- a/src/view/com/modals/Confirm.tsx
+++ b/src/view/com/modals/Confirm.tsx
@@ -19,10 +19,12 @@ export function Component({
   title,
   message,
   onPressConfirm,
+  onPressCancel,
 }: {
   title: string
   message: string | (() => JSX.Element)
   onPressConfirm: () => void | Promise<void>
+  onPressCancel?: () => void | Promise<void>
 }) {
   const pal = usePalette('default')
   const store = useStores()
@@ -69,12 +71,23 @@ export function Component({
           style={[styles.btn]}
           accessibilityRole="button"
           accessibilityLabel="Confirm"
-          // TODO: This needs to be updated so that modal roles are clear;
-          // Currently there is only one usage for the confirm modal: post deletion
-          accessibilityHint="Confirms a potentially destructive action">
+          accessibilityHint="">
           <Text style={[s.white, s.bold, s.f18]}>Confirm</Text>
         </TouchableOpacity>
       )}
+      {onPressCancel === undefined ? null : (
+        <TouchableOpacity
+          testID="cancelBtn"
+          onPress={onPressCancel}
+          style={[styles.btnCancel, s.mt10]}
+          accessibilityRole="button"
+          accessibilityLabel="Cancel"
+          accessibilityHint="">
+          <Text type="button-lg" style={pal.textLight}>
+            Cancel
+          </Text>
+        </TouchableOpacity>
+      )}
     </View>
   )
 }
@@ -104,4 +117,12 @@ const styles = StyleSheet.create({
     marginHorizontal: 44,
     backgroundColor: colors.blue3,
   },
+  btnCancel: {
+    flexDirection: 'row',
+    alignItems: 'center',
+    justifyContent: 'center',
+    borderRadius: 32,
+    padding: 14,
+    marginHorizontal: 20,
+  },
 })