on master help sign in
fix: support textareas
a907edaMatt Condon (shrugs)
src/indigo-react/components/Input.js+6−1
@@ -6,6 +6,7 @@ import { ErrorText } from './Typography';
6
6
7export default React.memo(function Input({
7export default React.memo(function Input({
8 // visuals
8 // visuals
9+ type,
9 name,
10 name,
10 label,
11 label,
11 className,
12 className,
@@ -33,6 +34,7 @@ export default React.memo(function Input({
33 transformers,
34 transformers,
34
35
35 // extra
36 // extra
37+ textarea = false,
36 ...rest
38 ...rest
37}) {
39}) {
38 // NB(shrugs): we disable exhaustive deps because we don't want the callbacks
40 // NB(shrugs): we disable exhaustive deps because we don't want the callbacks
@@ -67,8 +69,11 @@ export default React.memo(function Input({
67 </Flex.Item>
69 </Flex.Item>
68 <Flex.Item as={Flex} className="rel" row>
70 <Flex.Item as={Flex} className="rel" row>
69 <Flex.Item
71 <Flex.Item
70− as="input"
72+ as={type === 'textarea' ? 'textarea' : 'input'}
73+ type={type === 'textarea' ? undefined : type}
71 {...rest}
74 {...rest}
75+ // NOTE: 24px = 12px * 2 (from p3 styling)
76+ style={type === 'textarea' ? { minHeight: 'calc(1rem + 24px)' } : {}}
72 className={cn(
77 className={cn(
73 'b b1 p3 outline-none',
78 'b b1 p3 outline-none',
74 { mono },
79 { mono },
src/lib/useInputs.js+1−1
@@ -96,7 +96,7 @@ export function useMnemonicInput(props) {
96 return useFirstOf(
96 return useFirstOf(
97 useForm([
97 useForm([
98 {
98 {
99− type: 'text',
99+ type: 'textarea',
100 autoComplete: 'off',
100 autoComplete: 'off',
101 placeholder: PLACEHOLDER_MNEMONIC,
101 placeholder: PLACEHOLDER_MNEMONIC,
102 validators: kMnemonicValidators,
102 validators: kMnemonicValidators,