on master help sign in
fix: support textareas
commita907edafe77d7edfcee041c31eb37fb5d1d8ce45 authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateTue 23 Jul 2019, 14:17 (7 years ago) parentb95aae7
2 files changed+7−2
src/indigo-react/components/Input.js+6−1 src/lib/useInputs.js+1−1
src/indigo-react/components/Input.js+6−1
@@ -6,6 +6,7 @@ import { ErrorText } from './Typography';
66
77export default React.memo(function Input({
88 // visuals
9+ type,
910 name,
1011 label,
1112 className,
@@ -33,6 +34,7 @@ export default React.memo(function Input({
3334 transformers,
3435
3536 // extra
37+ textarea = false,
3638 ...rest
3739}) {
3840 // NB(shrugs): we disable exhaustive deps because we don't want the callbacks
@@ -67,8 +69,11 @@ export default React.memo(function Input({
6769 </Flex.Item>
6870 <Flex.Item as={Flex} className="rel" row>
6971 <Flex.Item
70− as="input"
72+ as={type === 'textarea' ? 'textarea' : 'input'}
73+ type={type === 'textarea' ? undefined : type}
7174 {...rest}
75+ // NOTE: 24px = 12px * 2 (from p3 styling)
76+ style={type === 'textarea' ? { minHeight: 'calc(1rem + 24px)' } : {}}
7277 className={cn(
7378 'b b1 p3 outline-none',
7479 { mono },
src/lib/useInputs.js+1−1
@@ -96,7 +96,7 @@ export function useMnemonicInput(props) {
9696 return useFirstOf(
9797 useForm([
9898 {
99− type: 'text',
99+ type: 'textarea',
100100 autoComplete: 'off',
101101 placeholder: PLACEHOLDER_MNEMONIC,
102102 validators: kMnemonicValidators,