-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { TextArea } from "./TextArea"; | ||
|
||
const meta: Meta = { | ||
title: "ds/TextArea", | ||
tags: ["autodocs"], | ||
}; | ||
export default meta; | ||
|
||
export const Default: StoryObj = { | ||
render: () => { | ||
return ( | ||
<div className="w-full mt-[160px] bg-white-yellow py-5 px-4"> | ||
<TextArea /> | ||
</div> | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useState } from "react"; | ||
import { MaxWidthBox } from "./MaxWidthBox"; | ||
import { Text, textVariants } from "./Text"; | ||
import { cn } from "./cn"; | ||
|
||
export const TextArea = () => { | ||
const [text, setText] = useState(""); | ||
|
||
return ( | ||
<MaxWidthBox className="w-full min-h-[343px] relative"> | ||
<textarea | ||
placeholder="내용을 입력해주세요" | ||
maxLength={1000} | ||
wrap="hard" | ||
required={true} | ||
onChange={(e) => setText(e.target.value)} | ||
className={cn( | ||
textVariants({ variant: "title/16_m" }), | ||
"w-full h-full min-h-[343px] bg-yellow-green py-[10px] px-[15px] rounded-3 text-gray-600 placeholder:gray-400", | ||
)} | ||
/> | ||
<Text | ||
variant="body/14_m" | ||
className={cn( | ||
"absolute bottom-[9px] right-[14px] text-gray-300", | ||
text.length > 0 && "text-gray-500", | ||
)} | ||
> | ||
{text.length} | ||
</Text> | ||
</MaxWidthBox> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters