Skip to content

Commit

Permalink
chore: add jsdoc annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jimniels committed Oct 15, 2023
1 parent c1d8ce7 commit d8bf8f1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/js/components/Textarea.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { autosize, html, React } from "../deps.js";
const { useEffect, useRef } = React;

/** @param {any} props */
export default function Textarea(props) {
const { children, ...rest } = props;
const ref = useRef(null);
useEffect(() => {
autosize(ref.current);
}, []);

/** @param {KeyboardEvent} e */
const onKeyDown = (e) => {
autosize(e.target);
};

return html`
<textarea
...${rest}
ref=${ref}
onKeyDown=${(e) => {
autosize(e.target);
}}
></textarea>
<textarea ...${props} ref=${ref} onKeyDown=${onKeyDown}></textarea>
`;
}

0 comments on commit d8bf8f1

Please # to comment.