Files
pwap/mobile/src/components/Card.tsx
T
pezkuwichain 1f8da810e0 fix: TypeScript errors, shadow deprecations, and build configuration
- Fix shadow style deprecation warnings across components (boxShadow)
- Add type declaration files (codec.d.ts, modules.d.ts)
- Update metro.config.cjs for proper asset extensions
- Update tsconfig.json with module resolution settings
- Fix TypeScript errors in shared/lib files
- Update app icons (optimized PNG files)
2026-01-15 09:37:37 +03:00

99 lines
2.0 KiB
TypeScript

import React from 'react';
import { View, StyleSheet, ViewStyle, Pressable, Text } from 'react-native';
import { AppColors } from '../theme/colors';
interface CardProps {
children: React.ReactNode;
title?: string;
style?: ViewStyle;
onPress?: () => void;
variant?: 'elevated' | 'outlined' | 'filled';
testID?: string;
elevation?: number;
}
/**
* Modern Card Component
* Inspired by Material Design 3 and Kurdistan aesthetics
*/
export const Card: React.FC<CardProps> = ({
children,
title,
style,
onPress,
variant = 'elevated',
testID,
elevation,
}) => {
const cardStyle = [
styles.card,
variant === 'elevated' && styles.elevated,
variant === 'outlined' && styles.outlined,
variant === 'filled' && styles.filled,
elevation && { elevation },
style,
];
const content = (
<>
{title && <Text style={styles.title}>{title}</Text>}
{children}
</>
);
if (onPress) {
return (
<Pressable
testID={testID}
onPress={onPress}
style={({ pressed }) => [
styles.card,
variant === 'elevated' && styles.elevated,
variant === 'outlined' && styles.outlined,
variant === 'filled' && styles.filled,
elevation ? { elevation } : null,
style,
pressed && styles.pressed,
]}
>
{content}
</Pressable>
);
}
return <View testID={testID} style={cardStyle as any}>{content}</View>;
};
const styles = StyleSheet.create({
card: {
borderRadius: 16,
padding: 16,
backgroundColor: AppColors.surface,
},
title: {
fontSize: 18,
fontWeight: '600',
color: AppColors.text,
marginBottom: 12,
},
elevated: {
boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.1)',
elevation: 4,
},
outlined: {
borderWidth: 1,
borderColor: AppColors.border,
boxShadow: 'none',
elevation: 0,
},
filled: {
backgroundColor: AppColors.background,
boxShadow: 'none',
elevation: 0,
},
pressed: {
opacity: 0.7,
transform: [{ scale: 0.98 }],
},
});