Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 73ff81c

Browse files
committed
reduce changes
1 parent fbe2f49 commit 73ff81c

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

apps/web/src/components/Fields/Date.tsx

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,22 @@ interface DateProps {
3030
disabled?: boolean
3131
}
3232

33-
const Date: React.FC<DateProps> = ({
34-
inputLabel,
35-
formik,
36-
id,
37-
errorMessage,
38-
autoSubmit,
39-
value,
40-
placeholder,
41-
altFormat,
42-
enableTime = false,
43-
dateFormat = 'Y-m-d',
44-
disabled = false,
45-
helperText,
46-
}) => {
33+
const Date: React.FC<DateProps> = (
34+
{
35+
inputLabel,
36+
formik,
37+
id,
38+
errorMessage,
39+
helperText,
40+
autoSubmit,
41+
value,
42+
placeholder,
43+
altFormat,
44+
enableTime = false,
45+
dateFormat = 'Y-m-d',
46+
disabled = false,
47+
}
48+
) => {
4749
const ref = React.useRef(null)
4850

4951
React.useEffect(() => {
@@ -69,6 +71,17 @@ const Date: React.FC<DateProps> = ({
6971
return (
7072
<Box as="fieldset" mb={'x8'} p={'x0'} className={defaultFieldsetStyle}>
7173
{inputLabel && <label className={defaultInputLabelStyle}>{inputLabel}</label>}
74+
{errorMessage && (
75+
<Box
76+
right={'x2'}
77+
top={'x15'}
78+
pt={'x4'}
79+
fontSize={14}
80+
className={defaultInputErrorMessageStyle}
81+
>
82+
{errorMessage as string}
83+
</Box>
84+
)}
7285
<input
7386
className={!!errorMessage ? defaultInputErrorStyle : defaultInputStyle}
7487
ref={ref}
@@ -90,17 +103,6 @@ const Date: React.FC<DateProps> = ({
90103
{helperText}
91104
</Box>
92105
)}
93-
{errorMessage && (
94-
<Box
95-
right={'x2'}
96-
top={'x15'}
97-
pt={'x4'}
98-
fontSize={14}
99-
className={defaultInputErrorMessageStyle}
100-
>
101-
{errorMessage as string}
102-
</Box>
103-
)}
104106
</Box>
105107
)
106108
}

apps/web/src/components/Fields/SmartInput.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,17 @@ const SmartInput: React.FC<SmartInputProps> = ({
113113
return (
114114
<Box as="fieldset" mb={'x8'} p={'x0'} className={defaultFieldsetStyle}>
115115
{inputLabel && <label className={defaultInputLabelStyle}>{inputLabel}</label>}
116-
116+
{errorMessage && (
117+
<Box
118+
position={'absolute'}
119+
right={'x2'}
120+
top={'x10'}
121+
fontSize={12}
122+
className={defaultInputErrorMessageStyle}
123+
>
124+
{errorMessage}
125+
</Box>
126+
)}
117127
<input
118128
id={id}
119129
type={type}
@@ -136,18 +146,6 @@ const SmartInput: React.FC<SmartInputProps> = ({
136146
: undefined
137147
}
138148
/>
139-
140-
{errorMessage && (
141-
<Box
142-
right={'x2'}
143-
top={'x15'}
144-
pt={'x4'}
145-
fontSize={14}
146-
className={defaultInputErrorMessageStyle}
147-
>
148-
{errorMessage}
149-
</Box>
150-
)}
151149
{isAddress && !!value.toString().length && !errorMessage && (
152150
<Flex
153151
align={'center'}

0 commit comments

Comments
 (0)