@@ -1,7 +1,6 @@
1import React from 'react';
1import React from 'react';
2import cn from 'classnames';
2import cn from 'classnames';
3import { useField } from 'react-final-form';
3import { useField } from 'react-final-form';
5import Flex from './Flex';
4import Flex from './Flex';
6import { ErrorText } from './Typography';
5import { ErrorText } from './Typography';
@@ -15,6 +14,7 @@ export default function Input({
15 disabled = false,
14 disabled = false,
16 mono = false,
15 mono = false,
19 // callbacks
19 // callbacks
@@ -32,6 +32,9 @@ export default function Input({
33 disabled = disabled || submitting;
33 disabled = disabled || submitting;
35+ // choose the base dom component
36+ const BaseComponent = type === 'textarea' ? 'textarea' : 'input';
35 // notify parent of enter keypress iff not disabled and passing
38 // notify parent of enter keypress iff not disabled and passing
36 // TODO: integrate this into react-final-form submission
39 // TODO: integrate this into react-final-form submission
37 // const onKeyPress = useCallback(
40 // const onKeyPress = useCallback(
@@ -39,6 +42,8 @@ export default function Input({
39 // [disabled, valid] // eslint-disable-line react-hooks/exhaustive-deps
42 // [disabled, valid] // eslint-disable-line react-hooks/exhaustive-deps
45+ // console.log(input);
@@ -61,7 +66,7 @@ export default function Input({
61 <Flex.Item as={Flex} row className="rel">
66 <Flex.Item as={Flex} row className="rel">
62 <Flex.Item
67 <Flex.Item
64− as={type === 'textarea' ? 'textarea' : 'input'}
69+ as={BaseComponent}
66 // NOTE: 24px = 12px * 2 (from p3 styling)
71 // NOTE: 24px = 12px * 2 (from p3 styling)
67 style={type === 'textarea' ? { minHeight: 'calc(1rem + 24px)' } : {}}
72 style={type === 'textarea' ? { minHeight: 'calc(1rem + 24px)' } : {}}