about summary refs log tree commit diff
path: root/src/components/Dialog
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-09-18 19:35:34 -0500
committerGitHub <noreply@github.com>2024-09-18 19:35:34 -0500
commitcbc7cd080889bbb8af052717d2831880ccd10475 (patch)
tree4dcd92ad101e00701479d31611735214852d32a6 /src/components/Dialog
parentfb3be7982024aed4cf141fbe3f658d8d6b0f94f5 (diff)
downloadvoidsky-cbc7cd080889bbb8af052717d2831880ccd10475.tar.zst
[Neue] Base (#5395)
* Add fontScale, gate it, fix some computes

* Add inter, integrate

* Clean up

* Apply to old Text component

* Use numeric weight

* Cleanup

* Clean up appearance settings

* Global tracking

* Fix regular italic variant

* Refactor settings and fontScale values

* Remove flags

* Get rid of lower weight font usage

* Remove gate from settings

* Refactor appearance settings for reuse

* Add neue type nux

* Update defaults

* Load fonts, add fallback families

* Load fonts via plugin in production

* Fixes

* Fix for web

* Nits

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/components/Dialog')
-rw-r--r--src/components/Dialog/index.tsx1
-rw-r--r--src/components/Dialog/index.web.tsx1
-rw-r--r--src/components/Dialog/utils.ts18
3 files changed, 20 insertions, 0 deletions
diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx
index cdce3765f..d5d92048a 100644
--- a/src/components/Dialog/index.tsx
+++ b/src/components/Dialog/index.tsx
@@ -37,6 +37,7 @@ import {Portal} from '#/components/Portal'
 
 export {useDialogContext, useDialogControl} from '#/components/Dialog/context'
 export * from '#/components/Dialog/types'
+export * from '#/components/Dialog/utils'
 // @ts-ignore
 export const Input = createInput(BottomSheetTextInput)
 
diff --git a/src/components/Dialog/index.web.tsx b/src/components/Dialog/index.web.tsx
index aff1842f7..bf20bd295 100644
--- a/src/components/Dialog/index.web.tsx
+++ b/src/components/Dialog/index.web.tsx
@@ -27,6 +27,7 @@ import {Portal} from '#/components/Portal'
 
 export {useDialogContext, useDialogControl} from '#/components/Dialog/context'
 export * from '#/components/Dialog/types'
+export * from '#/components/Dialog/utils'
 export {Input} from '#/components/forms/TextField'
 
 const stopPropagation = (e: any) => e.stopPropagation()
diff --git a/src/components/Dialog/utils.ts b/src/components/Dialog/utils.ts
new file mode 100644
index 000000000..058d6e804
--- /dev/null
+++ b/src/components/Dialog/utils.ts
@@ -0,0 +1,18 @@
+import React from 'react'
+
+import {DialogControlProps} from '#/components/Dialog/types'
+
+export function useAutoOpen(control: DialogControlProps, showTimeout?: number) {
+  React.useEffect(() => {
+    if (showTimeout) {
+      const timeout = setTimeout(() => {
+        control.open()
+      }, showTimeout)
+      return () => {
+        clearTimeout(timeout)
+      }
+    } else {
+      control.open()
+    }
+  }, [control, showTimeout])
+}