Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat/#74] textArea 컴포넌트로 구현 #77

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/page/community/component/TextArea/TextArea.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { color, font } from "@style/styles.css";
import { style } from "@vanilla-extract/css";

export const textareaContainer = style([
font.body01,
{
fontWeight: 500,
color: color.gray.gray900,
width: "100%",
minHeight: "23.5rem",
padding: "1.2rem",
borderRadius: "0.8rem",
border: `0.1rem solid ${color.gray.gray200}`,
background: color.gray.gray000,
"::placeholder": {
color: color.gray.gray600,
},
":focus": {
outline: "none",
},
},
]);

export const child = style({});
21 changes: 21 additions & 0 deletions src/page/community/component/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import { textareaContainer } from "./TextArea.css";

interface TextAreaProps {
value: string;
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
placeholder?: string;
}

const TextArea = ({ value, onChange, placeholder }: TextAreaProps) => {
return (
<textarea
value={value}
placeholder={placeholder}
onChange={onChange}
className={textareaContainer}
></textarea>
);
};

export default TextArea;
22 changes: 18 additions & 4 deletions src/page/community/write/Write.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import TextArea from "@page/community/component/TextArea/TextArea.tsx";
import React, { useState } from "react";

const Write = () => {
const [value, setValue] = useState("");
const onChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
setValue(e.target.value);
};
return (
<div>Write</div>
)
}
<div>
<TextArea
value={value}
onChange={onChange}
placeholder={
"커뮤니티에 올릴 게시글 내용을 작성해 주세요.\n\n (예시: ~한 증상은 어디로 가야 하나요?)"
}
/>
</div>
);
};

export default Write
export default Write;
Loading