feat: Sprint 0 — project scaffold, DB schema, Zustand stores, base UI components
This commit is contained in:
37
components/ui/Button.tsx
Normal file
37
components/ui/Button.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { TouchableOpacity, Text, ActivityIndicator } from 'react-native';
|
||||
|
||||
interface ButtonProps {
|
||||
label: string;
|
||||
onPress: () => void;
|
||||
variant?: 'primary' | 'secondary' | 'danger';
|
||||
loading?: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export function Button({ label, onPress, variant = 'primary', loading, disabled }: ButtonProps) {
|
||||
const base = 'rounded-xl py-4 px-6 items-center justify-center';
|
||||
const variants = {
|
||||
primary: 'bg-primary',
|
||||
secondary: 'bg-secondary border border-primary',
|
||||
danger: 'bg-danger',
|
||||
};
|
||||
const textColors = {
|
||||
primary: 'text-white',
|
||||
secondary: 'text-primary',
|
||||
danger: 'text-white',
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
className={`${base} ${variants[variant]} ${disabled || loading ? 'opacity-50' : ''}`}
|
||||
onPress={onPress}
|
||||
disabled={disabled || loading}
|
||||
>
|
||||
{loading ? (
|
||||
<ActivityIndicator color={variant === 'secondary' ? '#1A6B72' : 'white'} />
|
||||
) : (
|
||||
<Text className={`font-semibold text-base ${textColors[variant]}`}>{label}</Text>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
9
components/ui/Card.tsx
Normal file
9
components/ui/Card.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { View, ViewProps } from 'react-native';
|
||||
|
||||
export function Card({ children, className = '', ...props }: ViewProps & { className?: string }) {
|
||||
return (
|
||||
<View className={`bg-white rounded-2xl p-4 shadow-sm ${className}`} {...props}>
|
||||
{children}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
22
components/ui/Input.tsx
Normal file
22
components/ui/Input.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { View, Text, TextInput, TextInputProps } from 'react-native';
|
||||
|
||||
interface InputProps extends TextInputProps {
|
||||
label?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export function Input({ label, error, ...props }: InputProps) {
|
||||
return (
|
||||
<View className="mb-4">
|
||||
{label && <Text className="text-charcoal font-medium mb-1">{label}</Text>}
|
||||
<TextInput
|
||||
className={`border rounded-xl px-4 py-3 text-charcoal bg-white ${
|
||||
error ? 'border-danger' : 'border-gray-200'
|
||||
}`}
|
||||
placeholderTextColor="#9CA3AF"
|
||||
{...props}
|
||||
/>
|
||||
{error && <Text className="text-danger text-sm mt-1">{error}</Text>}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user