From 78a0f652347d262cfd910ad5dcf063a8f88df290 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 10 Jan 2024 16:45:42 -0600 Subject: [PATCH] Dialog contents --- src/view/com/Dialog/index.tsx | 14 +++++- src/view/com/Dialog/index.web.tsx | 71 +++++++++++++++++++++++++++++-- src/view/screens/DebugNew.tsx | 25 ++++++----- 3 files changed, 94 insertions(+), 16 deletions(-) diff --git a/src/view/com/Dialog/index.tsx b/src/view/com/Dialog/index.tsx index fc3f784704..2cf78022d2 100644 --- a/src/view/com/Dialog/index.tsx +++ b/src/view/com/Dialog/index.tsx @@ -2,6 +2,18 @@ import React from 'react' import {DialogProps} from '#/view/com/Dialog/types' -export function Dialog(props: React.PropsWithChildren) { +export function Outer(props: React.PropsWithChildren) { + return null +} + +export function Inner(props: React.PropsWithChildren<{}>) { + return null +} + +export function Header(props: React.PropsWithChildren<{ title: string }>) { + return null +} + +export function Close() { return null } diff --git a/src/view/com/Dialog/index.web.tsx b/src/view/com/Dialog/index.web.tsx index 9c6f09f4f3..a972a8f0d7 100644 --- a/src/view/com/Dialog/index.web.tsx +++ b/src/view/com/Dialog/index.web.tsx @@ -4,8 +4,11 @@ import {FocusScope} from '@tamagui/focus-scope' import Animated, {FadeInDown, FadeIn, FadeOut} from 'react-native-reanimated' import {useTheme, atoms as a, useBreakpoints} from '#/alf' +import {EventStopper} from '#/view/com/util/EventStopper' +import {H3, Text} from '#/view/com/Typography' import {Portal} from '#/view/com/Portal' import {DialogProps} from '#/view/com/Dialog/types' +import {Button} from '#/view/com/Button' const Context = React.createContext<{ dismiss: () => void @@ -17,7 +20,7 @@ export function useDialog() { return React.useContext(Context) } -export function Dialog({ +export function Outer({ isOpen, onDismiss, children, @@ -63,7 +66,7 @@ export function Dialog({ style={[ a.absolute, a.inset_0, - t.atoms.bg_contrast_100, + t.atoms.bg_contrast_200, {opacity: 0.8}, ]} /> @@ -81,8 +84,11 @@ export function Dialog({ - {children} + aria-role="dialog" + > + + {children} + @@ -94,3 +100,60 @@ export function Dialog({ ) } + +export function Inner(props: React.PropsWithChildren<{}>) { + const t = useTheme() + return ( + + {props.children} + + ) +} + +export function Header({ children, title }: React.PropsWithChildren<{ title: string }>) { + const t = useTheme() + return ( + +

{title}

+ {children} +
+ ) +} + +export function Close() { + const t = useTheme() + const {dismiss} = useDialog() + return ( + + + + ) +} diff --git a/src/view/screens/DebugNew.tsx b/src/view/screens/DebugNew.tsx index ce7f5c20a8..b72407d0d9 100644 --- a/src/view/screens/DebugNew.tsx +++ b/src/view/screens/DebugNew.tsx @@ -12,7 +12,7 @@ import {Text, H1, H2, H3, H4, H5, H6} from '#/view/com/Typography' import {InputText} from '#/view/com/forms/InputText' import {InputDate, utils} from '#/view/com/forms/InputDate' import {Logo} from '#/view/icons/Logo' -import {Dialog} from '#/view/com/Dialog' +import * as Dialog from '#/view/com/Dialog' function ThemeSelector() { const setColorMode = useSetColorMode() @@ -320,21 +320,24 @@ function Forms() { function Dialogs() { const [isOpen, setIsOpen] = React.useState(false) - console.log({isOpen}) - return ( <> - setIsOpen(false)}> - - - + setIsOpen(false)}> + + + + + + + + ) }