Skip to content
Merged
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
38 changes: 38 additions & 0 deletions components/Link/AddLinkInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { ChangeEvent, FormEvent, useState } from "react";
import { postLink } from "@/lib/api/link";
import Image from "next/image";
import Button from "../Button";

const AddLinkInput = (folderId: number) => {
const [value, setValue] = useState("");

const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
setValue(e.target.value);
};

const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
await postLink({ url: value, folderId });
// postLink 하고 추가된 link가 보이도록 하는 로직 구현해야 함.
};

return (
<form
onSubmit={handleSubmit}
className="flex gap-[12px] items-center w-[800px] h-[69px] py-[16px] px-[20px] border border-blue-500 rounded-[10px] md:w-[704px] sm:w-[325px] sm:h-[53px] transition-all"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py-[16px] px-[20px] 는 py-4 py-5 로 작성이 가능합니다 : )

>
<Image src="/icons/link.svg" width={20} height={20} alt="link icon" />
<input
onChange={handleChange}
value={value}
placeholder="링크를 추가해 보세요."
className="flex-grow"
/>
<Button color="positive" className="w-[80px] h-[37px]">
추가하기
</Button>
</form>
);
};

export default AddLinkInput;
Loading