From ecac0a5a8c2bbe660088e365781a2f4e97ac2de1 Mon Sep 17 00:00:00 2001 From: yotamts Date: Mon, 22 Dec 2025 10:23:51 +0200 Subject: [PATCH 01/18] Implemented component first steps - enums, props, basic logic layout, basic render function, basic styling --- .../src/components/screenFooter/index.tsx | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 packages/react-native-ui-lib/src/components/screenFooter/index.tsx diff --git a/packages/react-native-ui-lib/src/components/screenFooter/index.tsx b/packages/react-native-ui-lib/src/components/screenFooter/index.tsx new file mode 100644 index 0000000000..3b347dff25 --- /dev/null +++ b/packages/react-native-ui-lib/src/components/screenFooter/index.tsx @@ -0,0 +1,192 @@ +//IMPORTS +import React, { useCallback, useMemo } from 'react'; +import { Image, StyleSheet } from 'react-native'; +import View from '../view'; +import {Colors, Shadows, Spacings} from '../../style'; +import Button, { ButtonProps } from '../button'; +import { render } from '@testing-library/react-native'; + + +//ENUMS + +export enum ScreenFooterLayouts { + HORIZONTAL = 'horizontal', + VERTICAL = 'vertical' +} + +export enum ScreenFooterBackgrounds { + FADING = 'fading', + SOLID = 'solid', + //TRANSPARENT? +} + +//CHECK REGARDING A L/R ALLIGNMENT? +export enum FooterAlignment { + START = 'start', + CENTER = 'center', + END = 'end' +} + +export enum ItemsDistribution { + STACK = 'stack', + SPREAD = 'spread', + // SPACE_EVENLY = 'space-evenly', perhaps rely on stretch + gap? +} + +export enum ItemsFit { + FIT = 'fit', + STRETCH = 'stretch', + FIXED = 'fixed' +} + +export enum ScreenFooterPosition { + STICKY = 'sticky', + HOISTED = 'hoisted' +} + + +//TYPE + +export type ScreenFooterButtonProps = ButtonProps & { + stretch?: boolean; +} + +export interface ScreenFooterProps { + + background?: ScreenFooterBackgrounds | `${ScreenFooterBackgrounds}`; + + layout?: ScreenFooterLayouts | `${ScreenFooterLayouts}` + alignment?: FooterAlignment | `${FooterAlignment}` + itemsDistribution?: ItemsDistribution | `${ItemsDistribution}` + itemsFit?: ItemsFit | `${ItemsFit}` + + primaryButton?: ScreenFooterButtonProps; + secondaryButton?: ScreenFooterButtonProps; + tertiaryButton?: ScreenFooterButtonProps; + + //buttonMargin?: number + +} + +const screenFooter = (props: ScreenFooterProps) => { + + const { + layout, + alignment, + primaryButton, + secondaryButton, + tertiaryButton, + background + + } = props; + + // ADD STATE MANAGEMENT + //ADD HOOKS + + const isSolid = background === ScreenFooterBackgrounds.SOLID; + const isFading = background === ScreenFooterBackgrounds.FADING; + const isHorizontal = layout === ScreenFooterLayouts.HORIZONTAL; + + const contentContainerStyle = useMemo(() => { + + return [ + styles.contentContainer, + isHorizontal ? styles.horizontalContainer: styles.verticalContainer + //Add alignment logic also + ] + }, [layout, alignment]); + + + const renderBackground = useCallback(() => { + + if (isSolid) { + return + } + + else if (isFading) { + return ( + + + + ) + } + + return null; + + }, [isSolid, isFading]); + + const renderButton = (props: ScreenFooterButtonProps) => { + + const {stretch, style, ...others} = props; + + return ( +