mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-11 08:43:04 +00:00
feat: add autofocus input form create category
This commit is contained in:
@@ -3,6 +3,8 @@ import { useRouter } from "next/router";
|
|||||||
import nProgress from "nprogress";
|
import nProgress from "nprogress";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
|
|
||||||
|
import useAutoFocus from "../../hooks/useAutoFocus";
|
||||||
|
|
||||||
import FormLayout from "../../components/FormLayout";
|
import FormLayout from "../../components/FormLayout";
|
||||||
import TextBox from "../../components/TextBox";
|
import TextBox from "../../components/TextBox";
|
||||||
|
|
||||||
@@ -12,8 +14,10 @@ import { HandleAxiosError } from "../../utils/front";
|
|||||||
import styles from "../../styles/create.module.scss";
|
import styles from "../../styles/create.module.scss";
|
||||||
|
|
||||||
function CreateCategory() {
|
function CreateCategory() {
|
||||||
|
const autoFocusRef = useAutoFocus();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const info = useRouter().query?.info as string;
|
const info = useRouter().query?.info as string;
|
||||||
|
|
||||||
const [name, setName] = useState<string>("");
|
const [name, setName] = useState<string>("");
|
||||||
|
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
@@ -59,6 +63,7 @@ function CreateCategory() {
|
|||||||
value={name}
|
value={name}
|
||||||
fieldClass={styles["input-field"]}
|
fieldClass={styles["input-field"]}
|
||||||
placeholder="Nom..."
|
placeholder="Nom..."
|
||||||
|
innerRef={autoFocusRef}
|
||||||
/>
|
/>
|
||||||
</FormLayout>
|
</FormLayout>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user