Feat/editor as preview (#294)

* try editor as preview

* add databinding for editor actions and message

* add actions, reordering base interactions

* add drag and drop ordering for categoriers

* category skeleton

* fix linting issues

* add role list and add button, non-functional

* bump packages

* add role search prototype

* yarn.lock sync

* fix lint

* remove cfw-emulator bin
This commit is contained in:
41666 2021-07-08 16:51:00 -05:00 committed by GitHub
parent 7d681d69d6
commit ab3f718e6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 1157 additions and 741 deletions

View file

@ -94,18 +94,27 @@ const StyledTextarea = styled.textarea`
export const MultilineTextInput = (
props: TextInputProps<HTMLTextAreaElement> & { rows?: number }
) => {
const { ...rest } = props;
const { children, ...rest } = props;
const [value, setValue] = React.useState(String(props.value));
const rows = Math.min(10, Math.max(props.rows || 2, value.split(/\r?\n/).length));
const rows = React.useMemo(
() => Math.min(10, Math.max(props.rows || 2, value.split(/\r?\n/).length)),
[value]
);
React.useEffect(() => {
setValue(String(props.value));
}, [props.value]);
return (
<StyledTextarea
{...rest}
rows={rows}
value={value}
onChange={(eventData) => {
setValue(eventData.target.value);
props.onChange?.(eventData);
}}
/>
>
{value}
</StyledTextarea>
);
};