some style adjustments
This commit is contained in:
@@ -18,7 +18,7 @@ const parseDate = (str) => {
|
||||
return new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
|
||||
};
|
||||
|
||||
const DateInput = ({ label, value, onChange, placeholder = 'Saýla', maximumDate, minimumDate }) => {
|
||||
const DateInput = ({ label, value, onChange, placeholder = 'Saýla', maximumDate, minimumDate, error = false }) => {
|
||||
const [show, setShow] = useState(false);
|
||||
const [tempDate, setTempDate] = useState(value ? (typeof value === 'string' ? parseDate(value) : value) : new Date());
|
||||
|
||||
@@ -43,8 +43,10 @@ const DateInput = ({ label, value, onChange, placeholder = 'Saýla', maximumDate
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{label && <Text style={styles.label}>{label}</Text>}
|
||||
<TouchableOpacity style={styles.selectBox} onPress={open} activeOpacity={0.7}>
|
||||
{label && (
|
||||
<Text style={[styles.label, typeof label === 'string' && label.trim().startsWith('*') && styles.requiredLabel]}>{label}</Text>
|
||||
)}
|
||||
<TouchableOpacity style={[styles.selectBox, error && styles.error]} onPress={open} activeOpacity={0.7}>
|
||||
<Text style={[styles.selectText, !value && { color: COLORS.gray[400] }]}>{value || placeholder}</Text>
|
||||
<Ionicons name="calendar" size={18} color={COLORS.gray[400]} />
|
||||
</TouchableOpacity>
|
||||
@@ -101,6 +103,9 @@ const styles = StyleSheet.create({
|
||||
color: COLORS.textPrimary,
|
||||
marginBottom: 8,
|
||||
},
|
||||
requiredLabel: {
|
||||
color: COLORS.error,
|
||||
},
|
||||
selectBox: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
@@ -112,6 +117,9 @@ const styles = StyleSheet.create({
|
||||
paddingHorizontal: 16,
|
||||
minHeight: 52,
|
||||
},
|
||||
error: {
|
||||
borderColor: COLORS.error,
|
||||
},
|
||||
selectText: {
|
||||
fontSize: 16,
|
||||
color: COLORS.textPrimary,
|
||||
|
||||
@@ -34,7 +34,9 @@ const ImageInput = ({ label, image, onChange, error = false }) => {
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{label && <Text style={styles.label}>{label}</Text>}
|
||||
{label && (
|
||||
<Text style={[styles.label, typeof label === 'string' && label.trim().startsWith('*') && styles.requiredLabel]}>{label}</Text>
|
||||
)}
|
||||
<TouchableOpacity style={[styles.box, error && styles.error]} activeOpacity={0.8} onPress={pickImage}>
|
||||
{image ? (
|
||||
<Image source={{ uri: image.uri ? image.uri : image }} style={styles.preview} />
|
||||
@@ -59,6 +61,9 @@ const styles = StyleSheet.create({
|
||||
color: COLORS.textPrimary,
|
||||
marginBottom: 8,
|
||||
},
|
||||
requiredLabel: {
|
||||
color: COLORS.error,
|
||||
},
|
||||
box: {
|
||||
borderWidth: 1,
|
||||
borderColor: COLORS.gray[300],
|
||||
|
||||
@@ -27,7 +27,11 @@ const Input = forwardRef(({
|
||||
|
||||
return (
|
||||
<View style={[styles.container, style]}>
|
||||
{label && <Text style={styles.label}>{label}</Text>}
|
||||
{label && (
|
||||
<Text style={[styles.label, typeof label === 'string' && label.trim().startsWith('*') && styles.requiredLabel]}>
|
||||
{label}
|
||||
</Text>
|
||||
)}
|
||||
<View style={[
|
||||
styles.inputContainer,
|
||||
isFocused && styles.focused,
|
||||
@@ -83,6 +87,9 @@ const styles = StyleSheet.create({
|
||||
color: COLORS.textPrimary,
|
||||
marginBottom: 8,
|
||||
},
|
||||
requiredLabel: {
|
||||
color: COLORS.error,
|
||||
},
|
||||
inputContainer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
|
||||
@@ -52,7 +52,9 @@ const SelectInput = ({
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{label && <Text style={styles.label}>{label}</Text>}
|
||||
{label && (
|
||||
<Text style={[styles.label, typeof label === 'string' && label.trim().startsWith('*') && styles.requiredLabel]}>{label}</Text>
|
||||
)}
|
||||
<TouchableOpacity
|
||||
style={[styles.selectBox, disabled && styles.disabled, error && styles.error]}
|
||||
onPress={openModal}
|
||||
@@ -108,6 +110,9 @@ const styles = StyleSheet.create({
|
||||
color: COLORS.textPrimary,
|
||||
marginBottom: 8,
|
||||
},
|
||||
requiredLabel: {
|
||||
color: COLORS.error,
|
||||
},
|
||||
selectBox: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
|
||||
Reference in New Issue
Block a user