From 953c749c707538cffb01ba1b2d7155b668e0520d Mon Sep 17 00:00:00 2001 From: G Date: Fri, 5 Sep 2025 15:29:40 +0000 Subject: [PATCH] feat: imported composite component from the public app (button, input and modal) --- src/components/ButtonNew.tsx | 42 ++++++++++++++++++++++++++++++++++++++++++ src/components/InputNew.tsx | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/components/Modal.tsx | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 src/components/ButtonNew.tsx create mode 100644 src/components/InputNew.tsx create mode 100644 src/components/Modal.tsx diff --git a/src/components/ButtonNew.tsx b/src/components/ButtonNew.tsx new file mode 100644 index 0000000..e260e5c --- /dev/null +++ b/src/components/ButtonNew.tsx @@ -0,0 +1,42 @@ +import { asp as g } from "@asp/asp"; +import type { FC } from "react"; +import { + ActivityIndicator, + Text, + type TextProps, + TouchableOpacity, + type TouchableOpacityProps, +} from "react-native"; + +const DEFAULT_HEIGHT = 50; + +type ContainerProps = TouchableOpacityProps & { + isLoading?: boolean; +}; + +export const Container: FC = ({ children, style, isLoading, onPress, ...rest }) => { + return ( + + {isLoading ? : children} + + ); +}; + +export const Label: FC = ({ children, style, ...rest }) => { + return ( + + {children} + + ); +}; diff --git a/src/components/InputNew.tsx b/src/components/InputNew.tsx new file mode 100644 index 0000000..94b0ece --- /dev/null +++ b/src/components/InputNew.tsx @@ -0,0 +1,70 @@ +import { asp as g } from "@asp/asp"; +import type { FC } from "react"; +import { + Text, + TextInput, + type TextInputProps, + type TextProps, + View, + type ViewProps, +} from "react-native"; + +const DEFAULT_HEIGHT = 50; + +export const Container: FC = ({ children, style, ...rest }) => { + return ( + + {children} + + ); +}; + +export const Header: FC = ({ children, style, ...rest }) => { + return ( + + {children} + + ); +}; + +export const FieldContainer: FC = ({ children, style, ...rest }) => { + return ( + + {children} + + ); +}; + +export const Field: FC }> = ({ + style, + ref, + ...props +}) => { + return ( + + ); +}; diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx new file mode 100644 index 0000000..83458f7 --- /dev/null +++ b/src/components/Modal.tsx @@ -0,0 +1,64 @@ +import { asp as g } from "@asp/asp"; +import type { FC } from "react"; +import { Modal, type ModalProps, View, type ViewProps, type ViewStyle } from "react-native"; +import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context"; + +/** + * A view container that wraps a {@link SafeAreaView} and a {@link SafeAreaProvider}. + * This is useful for modal components that should be centered and have a safe area. + * + * @param {ViewProps} props The props to pass to the {@link View} component. + * @returns {React.ReactElement} The container component. + */ +export const SafeView: FC = ({ children, style, ...rest }) => { + return ( + + + {children} + + + ); +}; + +/** + * RnModal is a styled Modal component that provides a basic styling for the + * inner content of a modal. It centers the content horizontally and vertically + * and provides a light green background color with rounded corners. + * + * @param {JSX.Element | JSX.Element[]} children The content to be rendered + * inside the modal. + * @param {ViewStyle} style Optional style overrides for the modal's outer View. + * @param {ModalProps} rest Optional props. + * + * @returns A styled Modal component with the inner content. + */ +export const RnModal: FC = ({ children, style, ...rest }) => { + return ( + + {children} + + ); +}; + +/** + * OuterView is a styled View component that provides a basic styling for the + * inner content of a modal. It centers the content horizontally and vertically + * and provides a light green background color with rounded corners. + * + * @param {JSX.Element | JSX.Element[]} children The content to be rendered + * inside the modal. + * @param {ViewProps} style Optional style overrides. + * @param {ViewProps} rest Optional props. + * + * @returns A styled View component with the inner content. + */ +export const OuterView: FC = ({ children, style, ...rest }) => { + return ( + + {children} + + ); +}; -- libgit2 0.27.1