14c880123c
Expo app with dashboard, time clock, invoices, and settings — native tabs, glass UI, theme-aware components, and iOS Live Activities. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
import {
|
|
StyleSheet,
|
|
Text,
|
|
TextInput,
|
|
View,
|
|
type TextInputProps,
|
|
} from "react-native";
|
|
|
|
import { useAppTheme } from "@/contexts/ThemeContext";
|
|
import { fonts, radii, spacing } from "@/constants/theme";
|
|
|
|
type InputProps = TextInputProps & {
|
|
label: string;
|
|
error?: string;
|
|
};
|
|
|
|
export function Input({ label, error, style, ...props }: InputProps) {
|
|
const { colors } = useAppTheme();
|
|
|
|
return (
|
|
<View style={styles.wrapper}>
|
|
<Text style={[styles.label, { color: colors.foreground }]}>{label}</Text>
|
|
<TextInput
|
|
placeholderTextColor={colors.mutedForeground}
|
|
style={[
|
|
styles.input,
|
|
{
|
|
borderColor: colors.border,
|
|
color: colors.foreground,
|
|
backgroundColor: colors.cardGlass,
|
|
},
|
|
error && { borderColor: colors.destructive },
|
|
style,
|
|
]}
|
|
{...props}
|
|
/>
|
|
{error ? <Text style={[styles.error, { color: colors.destructive }]}>{error}</Text> : null}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
wrapper: {
|
|
gap: spacing.sm,
|
|
},
|
|
label: {
|
|
fontSize: 14,
|
|
fontFamily: fonts.bodyMedium,
|
|
},
|
|
input: {
|
|
minHeight: 40,
|
|
borderWidth: 1,
|
|
borderRadius: radii.md,
|
|
paddingHorizontal: spacing.md,
|
|
fontSize: 14,
|
|
fontFamily: fonts.body,
|
|
},
|
|
error: {
|
|
fontSize: 13,
|
|
fontFamily: fonts.body,
|
|
},
|
|
});
|