# ログイン画面の作成3

`LoginPage.tsx`をリファクタします。

`components/atoms`配下に、`Input.tsx`を作成しましょう。

こちらに関して、inputタグの元々の属性全て受け取れるようにするため`props`を受け取り、`{...props}`としてプロパティを全て展開してinputタグに渡すようにします。

propsの型に関しては、`ComponentProps<"input">`とすることで、inputタグの全ての属性の型を宣言することができます。

<pre class="language-tsx" data-title="atoms/Input.tsx◎"><code class="lang-tsx"><strong>import { ComponentProps } from "react";
</strong><strong>
</strong><strong>export const Input = (props: ComponentProps&#x3C;"input">) => {
</strong><strong>  return (
</strong><strong>    &#x3C;input
</strong><strong>      {...props}
</strong><strong>      className="w-full border-4 border-solid border-lime-800 rounded-md p-2"
</strong><strong>    />
</strong><strong>  );
</strong><strong>};
</strong>
</code></pre>

では、こちらのInputコンポーネントを`LoginPage.tsx`にて呼び出しましょう。

<pre class="language-tsx" data-title="pages/LoginPage.tsx◎"><code class="lang-tsx"><strong>import { Input } from "../atoms/Input";
</strong>import { PrimaryBtn } from "../atoms/PrimaryBtn";

export const LoginPage = () => {
  return (
    &#x3C;div className="w-[500px] bg-white rounded-lg shadow-lg py-10">
      &#x3C;form className="flex flex-col justify-center items-center gap-10">
        &#x3C;h1 className="text-3xl text-lime-800 font-bold text-center">
          ログイン
        &#x3C;/h1>
        &#x3C;div className="w-[80%]">
<strong>          &#x3C;Input
</strong><strong>            type="text"
</strong><strong>            placeholder="email"
</strong><strong>          />
</strong>        &#x3C;/div>
        &#x3C;div className="w-[80%]">
<strong>          &#x3C;Input
</strong><strong>            type="password"
</strong><strong>            placeholder="password"
</strong><strong>          />
</strong>        &#x3C;/div>
        &#x3C;PrimaryBtn>ログイン&#x3C;/PrimaryBtn>
      &#x3C;/form>
    &#x3C;/div>
  );
};

</code></pre>

ここまでの作業をcommitしましょう。

```bash
git add .
```

```bash
git commit
```

commitメッセージは

```
refactor: ログイン画面のinputタグをコンポーネントに切り出した
```

としましょう。
