AccountNotePanel: use our native Textarea component
This commit is contained in:
parent
ad329c33fa
commit
5bd1eab607
2 changed files with 13 additions and 11 deletions
|
@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl';
|
||||||
import Stack from '../stack/stack';
|
import Stack from '../stack/stack';
|
||||||
import Text from '../text/text';
|
import Text from '../text/text';
|
||||||
|
|
||||||
interface ITextarea extends Pick<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'maxLength' | 'onChange' | 'onKeyDown' | 'onPaste' | 'required' | 'disabled' | 'rows' | 'readOnly'> {
|
interface ITextarea extends Pick<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'id' | 'maxLength' | 'onChange' | 'onKeyDown' | 'onPaste' | 'required' | 'disabled' | 'rows' | 'readOnly'> {
|
||||||
/** Put the cursor into the input on mount. */
|
/** Put the cursor into the input on mount. */
|
||||||
autoFocus?: boolean;
|
autoFocus?: boolean;
|
||||||
/** Allows the textarea height to grow while typing */
|
/** Allows the textarea height to grow while typing */
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
||||||
import Textarea from 'react-textarea-autosize';
|
|
||||||
|
|
||||||
import { submitAccountNote } from 'soapbox/actions/account-notes';
|
import { submitAccountNote } from 'soapbox/actions/account-notes';
|
||||||
import { HStack, Text, Widget } from 'soapbox/components/ui';
|
import { HStack, Text, Textarea, Widget } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch } from 'soapbox/hooks';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
|
|
||||||
import type { Account as AccountEntity } from 'soapbox/schemas';
|
import type { Account as AccountEntity } from 'soapbox/schemas';
|
||||||
|
@ -64,14 +63,17 @@ const AccountNotePanel: React.FC<IAccountNotePanel> = ({ account }) => {
|
||||||
)}
|
)}
|
||||||
</HStack>}
|
</HStack>}
|
||||||
>
|
>
|
||||||
<Textarea
|
<div className='-mx-2'>
|
||||||
id={`account-note-${account.id}`}
|
<Textarea
|
||||||
className='mx-[-8px] w-full resize-none rounded-md border-0 bg-transparent p-2 text-sm text-gray-800 transition-colors placeholder:text-gray-600 focus:border-0 focus:bg-white focus:shadow-none focus:ring-0 motion-reduce:transition-none dark:text-white dark:placeholder:text-gray-600 focus:dark:bg-primary-900'
|
id={`account-note-${account.id}`}
|
||||||
placeholder={intl.formatMessage(messages.placeholder)}
|
theme='transparent'
|
||||||
value={value || ''}
|
placeholder={intl.formatMessage(messages.placeholder)}
|
||||||
onChange={handleChange}
|
value={value || ''}
|
||||||
ref={textarea}
|
onChange={handleChange}
|
||||||
/>
|
ref={textarea}
|
||||||
|
autoGrow
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</Widget>
|
</Widget>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue