feat: Sprint 0 — project scaffold, DB schema, Zustand stores, base UI components

This commit is contained in:
root
2026-02-18 06:21:22 +08:00
commit 8f66a4d4ed
22 changed files with 497 additions and 0 deletions

37
components/ui/Button.tsx Normal file
View 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
View 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
View 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>
);
}