mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-11 08:43:04 +00:00
feat: make all forms responsive
This commit is contained in:
@@ -3,8 +3,6 @@ import Link from "next/link";
|
|||||||
|
|
||||||
import MessageManager from "components/MessageManager/MessageManager";
|
import MessageManager from "components/MessageManager/MessageManager";
|
||||||
|
|
||||||
import styles from "styles/create.module.scss";
|
|
||||||
|
|
||||||
interface FormProps {
|
interface FormProps {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@@ -39,29 +37,23 @@ export default function Form({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NextSeo title={title} />
|
<NextSeo title={title} />
|
||||||
<div className={`App ${styles["create-app"]}`}>
|
<h2>{title}</h2>
|
||||||
<h2>{title}</h2>
|
<form onSubmit={handleSubmit}>
|
||||||
<form onSubmit={handleSubmit}>
|
{children}
|
||||||
{children}
|
<button type="submit" className={classBtnConfirm} disabled={!canSubmit}>
|
||||||
<button
|
{textBtnConfirm}
|
||||||
type="submit"
|
</button>
|
||||||
className={classBtnConfirm}
|
</form>
|
||||||
disabled={!canSubmit}
|
{!disableHomeLink && (
|
||||||
>
|
<Link href={categoryId ? `/?categoryId=${categoryId}` : "/"}>
|
||||||
{textBtnConfirm}
|
← Revenir à l'accueil
|
||||||
</button>
|
</Link>
|
||||||
</form>
|
)}
|
||||||
{!disableHomeLink && (
|
<MessageManager
|
||||||
<Link href={categoryId ? `/?categoryId=${categoryId}` : "/"}>
|
info={infoMessage}
|
||||||
← Revenir à l'accueil
|
error={errorMessage}
|
||||||
</Link>
|
success={successMessage}
|
||||||
)}
|
/>
|
||||||
<MessageManager
|
|
||||||
info={infoMessage}
|
|
||||||
error={errorMessage}
|
|
||||||
success={successMessage}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.modal-container {
|
.modal-container {
|
||||||
height: calc(100% - 2em);
|
max-height: calc(100% - 2em);
|
||||||
width: calc(100% - 2em);
|
width: calc(100% - 2em);
|
||||||
min-width: unset;
|
min-width: unset;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ import TextBox from "components/TextBox";
|
|||||||
|
|
||||||
import PATHS from "constants/paths";
|
import PATHS from "constants/paths";
|
||||||
import useAutoFocus from "hooks/useAutoFocus";
|
import useAutoFocus from "hooks/useAutoFocus";
|
||||||
import { redirectWithoutClientCache } from "utils/client";
|
|
||||||
import { HandleAxiosError } from "utils/front";
|
|
||||||
|
|
||||||
import getUserCategoriesCount from "lib/category/getUserCategoriesCount";
|
import getUserCategoriesCount from "lib/category/getUserCategoriesCount";
|
||||||
import getUser from "lib/user/getUser";
|
import getUser from "lib/user/getUser";
|
||||||
import styles from "styles/create.module.scss";
|
import { redirectWithoutClientCache } from "utils/client";
|
||||||
|
import { HandleAxiosError } from "utils/front";
|
||||||
import { getSession } from "utils/session";
|
import { getSession } from "utils/session";
|
||||||
|
|
||||||
|
import styles from "styles/form.module.scss";
|
||||||
|
|
||||||
function CreateCategory({ categoriesCount }: { categoriesCount: number }) {
|
function CreateCategory({ categoriesCount }: { categoriesCount: number }) {
|
||||||
const autoFocusRef = useAutoFocus();
|
const autoFocusRef = useAutoFocus();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -52,7 +52,7 @@ function CreateCategory({ categoriesCount }: { categoriesCount: number }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageTransition className="page-category-create">
|
<PageTransition className={styles["form-container"]}>
|
||||||
<FormLayout
|
<FormLayout
|
||||||
title="Créer une catégorie"
|
title="Créer une catégorie"
|
||||||
errorMessage={error}
|
errorMessage={error}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { Category } from "types";
|
|||||||
import { HandleAxiosError } from "utils/front";
|
import { HandleAxiosError } from "utils/front";
|
||||||
import { getSession } from "utils/session";
|
import { getSession } from "utils/session";
|
||||||
|
|
||||||
import styles from "styles/create.module.scss";
|
import styles from "styles/form.module.scss";
|
||||||
|
|
||||||
function EditCategory({ category }: { category: Category }) {
|
function EditCategory({ category }: { category: Category }) {
|
||||||
const autoFocusRef = useAutoFocus();
|
const autoFocusRef = useAutoFocus();
|
||||||
@@ -52,7 +52,7 @@ function EditCategory({ category }: { category: Category }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageTransition className="page-category-edit">
|
<PageTransition className={styles["form-container"]}>
|
||||||
<FormLayout
|
<FormLayout
|
||||||
title="Modifier une catégorie"
|
title="Modifier une catégorie"
|
||||||
errorMessage={error}
|
errorMessage={error}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { Category } from "types";
|
|||||||
import { HandleAxiosError } from "utils/front";
|
import { HandleAxiosError } from "utils/front";
|
||||||
import { getSession } from "utils/session";
|
import { getSession } from "utils/session";
|
||||||
|
|
||||||
import styles from "styles/create.module.scss";
|
import styles from "styles/form.module.scss";
|
||||||
|
|
||||||
function RemoveCategory({ category }: { category: Category }) {
|
function RemoveCategory({ category }: { category: Category }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -51,7 +51,7 @@ function RemoveCategory({ category }: { category: Category }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageTransition className="page-category-remove">
|
<PageTransition className={styles["form-container"]}>
|
||||||
<FormLayout
|
<FormLayout
|
||||||
title="Supprimer une catégorie"
|
title="Supprimer une catégorie"
|
||||||
categoryId={category.id.toString()}
|
categoryId={category.id.toString()}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { Category, Link } from "types";
|
|||||||
import { HandleAxiosError, IsValidURL } from "utils/front";
|
import { HandleAxiosError, IsValidURL } from "utils/front";
|
||||||
import { getSession } from "utils/session";
|
import { getSession } from "utils/session";
|
||||||
|
|
||||||
import styles from "styles/create.module.scss";
|
import styles from "styles/form.module.scss";
|
||||||
|
|
||||||
function CreateLink({ categories }: { categories: Category[] }) {
|
function CreateLink({ categories }: { categories: Category[] }) {
|
||||||
const autoFocusRef = useAutoFocus();
|
const autoFocusRef = useAutoFocus();
|
||||||
@@ -64,7 +64,7 @@ function CreateLink({ categories }: { categories: Category[] }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageTransition className="page-link-create">
|
<PageTransition className={styles["form-container"]}>
|
||||||
<FormLayout
|
<FormLayout
|
||||||
title="Créer un lien"
|
title="Créer un lien"
|
||||||
categoryId={categoryIdQuery}
|
categoryId={categoryIdQuery}
|
||||||
|
|||||||
@@ -9,17 +9,16 @@ import PageTransition from "components/PageTransition";
|
|||||||
import Selector from "components/Selector";
|
import Selector from "components/Selector";
|
||||||
import TextBox from "components/TextBox";
|
import TextBox from "components/TextBox";
|
||||||
|
|
||||||
|
import PATHS from "constants/paths";
|
||||||
import useAutoFocus from "hooks/useAutoFocus";
|
import useAutoFocus from "hooks/useAutoFocus";
|
||||||
|
import getUserCategories from "lib/category/getUserCategories";
|
||||||
|
import getUserLink from "lib/link/getUserLink";
|
||||||
|
import getUser from "lib/user/getUser";
|
||||||
import { Category, Link } from "types";
|
import { Category, Link } from "types";
|
||||||
import { HandleAxiosError, IsValidURL } from "utils/front";
|
import { HandleAxiosError, IsValidURL } from "utils/front";
|
||||||
import { getSession } from "utils/session";
|
import { getSession } from "utils/session";
|
||||||
|
|
||||||
import getUserCategories from "lib/category/getUserCategories";
|
import styles from "styles/form.module.scss";
|
||||||
import getUserLink from "lib/link/getUserLink";
|
|
||||||
|
|
||||||
import PATHS from "constants/paths";
|
|
||||||
import getUser from "lib/user/getUser";
|
|
||||||
import styles from "styles/create.module.scss";
|
|
||||||
|
|
||||||
function EditLink({
|
function EditLink({
|
||||||
link,
|
link,
|
||||||
@@ -85,7 +84,7 @@ function EditLink({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageTransition className="page-link-edit">
|
<PageTransition className={styles["form-container"]}>
|
||||||
<FormLayout
|
<FormLayout
|
||||||
title="Modifier un lien"
|
title="Modifier un lien"
|
||||||
errorMessage={error}
|
errorMessage={error}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { Link } from "types";
|
|||||||
import { HandleAxiosError } from "utils/front";
|
import { HandleAxiosError } from "utils/front";
|
||||||
import { getSession } from "utils/session";
|
import { getSession } from "utils/session";
|
||||||
|
|
||||||
import styles from "styles/create.module.scss";
|
import styles from "styles/form.module.scss";
|
||||||
|
|
||||||
function RemoveLink({ link }: { link: Link }) {
|
function RemoveLink({ link }: { link: Link }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -46,7 +46,7 @@ function RemoveLink({ link }: { link: Link }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageTransition className="page-link-remove">
|
<PageTransition className={styles["form-container"]}>
|
||||||
<FormLayout
|
<FormLayout
|
||||||
title="Supprimer un lien"
|
title="Supprimer un lien"
|
||||||
categoryId={link.category.id.toString()}
|
categoryId={link.category.id.toString()}
|
||||||
|
|||||||
@@ -1,34 +1,36 @@
|
|||||||
@import "keyframes.scss";
|
@import "keyframes.scss";
|
||||||
@import "colors.scss";
|
@import "colors.scss";
|
||||||
|
|
||||||
.create-app {
|
.form-container {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
width: 680px;
|
width: 768px;
|
||||||
margin-top: 150px;
|
margin-top: 10em;
|
||||||
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 15px;
|
gap: 0.75em;
|
||||||
|
|
||||||
& h2 {
|
& h2 {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
& form {
|
& form {
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 5px;
|
gap: 0.5em;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .input-field {
|
& .input-field {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 5px;
|
gap: 0.25em;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 680px) {
|
@media (max-width: 768px) {
|
||||||
.create-app {
|
.form-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-top: 5em;
|
||||||
|
padding: 0 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user