Skip to content

Commit

Permalink
feat: resize text area 구현 (#85)
Browse files Browse the repository at this point in the history
#62

Co-authored-by: yeonddori <[email protected]>
  • Loading branch information
pipisebastian and yeonddori authored Feb 21, 2024
1 parent 1f89631 commit 04ae4b5
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
56 changes: 55 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"next": "14.0.4",
"react": "^18",
"react-dom": "^18",
"react-icons": "^5.0.1"
"react-icons": "^5.0.1",
"react-textarea-autosize": "^8.5.3"
},
"devDependencies": {
"@swc-jotai/react-refresh": "^0.1.0",
Expand Down
12 changes: 12 additions & 0 deletions src/components/AutoResizeTextarea/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable react/jsx-props-no-spreading */
import { Textarea, forwardRef } from '@chakra-ui/react';
import React from 'react';
import ResizeTextarea from 'react-textarea-autosize';

import { AutoResizeTextareaProps } from './type';

const AutoResizeTextarea = forwardRef(({ ref, ...props }: AutoResizeTextareaProps) => (
<Textarea ref={ref} as={ResizeTextarea} overflow="hidden" w="100%" minH="unset" resize="none" {...props} />
));

export default AutoResizeTextarea;
3 changes: 3 additions & 0 deletions src/components/AutoResizeTextarea/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface AutoResizeTextareaProps {
ref?: React.Ref<HTMLTextAreaElement>;
}

0 comments on commit 04ae4b5

Please sign in to comment.