managarten/apps/picture/packages/mobile-ui/components/ui/Container/Container.tsx
Wuesteon d36b321d9d style: auto-format codebase with Prettier
Applied formatting to 1487+ files using pnpm format:write
  - TypeScript/JavaScript files
  - Svelte components
  - Astro pages
  - JSON configs
  - Markdown docs

  13 files still need manual review (Astro JSX comments)
2025-11-27 18:33:16 +01:00

54 lines
1.2 KiB
TypeScript

import { ReactNode } from 'react';
import { ViewStyle } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
export type ContainerProps = {
/** Content to render inside the container */
children: ReactNode;
/** Background color */
backgroundColor?: string;
/** Apply padding to the container */
padding?: boolean;
/** Custom padding value (overrides default) */
paddingValue?: number;
/** Additional styles */
style?: ViewStyle;
/** CSS class names (NativeWind/Tailwind) */
className?: string;
};
/**
* Safe area container component that wraps content with padding and safe area handling.
*
* @example
* ```tsx
* <Container>
* <Text>Content</Text>
* </Container>
*
* <Container backgroundColor="#F3F4F6" padding={false}>
* <Text>Custom container</Text>
* </Container>
* ```
*/
export const Container = ({
children,
backgroundColor = '#FFFFFF',
padding = true,
paddingValue = 24,
style,
className = '',
}: ContainerProps) => {
return (
<SafeAreaView
className={`flex flex-1 ${padding ? `p-6` : ''} ${className}`}
style={{
backgroundColor,
...(padding && paddingValue !== 24 && { padding: paddingValue }),
...style,
}}
>
{children}
</SafeAreaView>
);
};