mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 15:35:35 +00:00
Beaucoup trop de chose
- Ajout création, édition, suppression catégories & liens - Ajout auth google - Ajout/modification style pour catégories & liens - Ajout component générique pour bouton, inputs, checkbox & selector - Gestion des messages d'erreur/succès/infos via component dédié - Ajout component FormLayout pour les pages création, édition, suppression catégories & liens - Page custom 404, 500 & signin - Modification schéma DB
This commit is contained in:
55
components/FormLayout.tsx
Normal file
55
components/FormLayout.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import Head from 'next/head';
|
||||
import Link from 'next/link';
|
||||
|
||||
import MessageManager from './MessageManager';
|
||||
|
||||
import styles from '../styles/create.module.scss';
|
||||
|
||||
interface FormProps {
|
||||
title: string;
|
||||
errorMessage?: string;
|
||||
successMessage?: string;
|
||||
infoMessage?: string;
|
||||
|
||||
canSubmit: boolean;
|
||||
handleSubmit: (event) => void;
|
||||
|
||||
textBtnConfirm?: string;
|
||||
classBtnConfirm?: string;
|
||||
|
||||
children: any;
|
||||
}
|
||||
export default function Form({
|
||||
title,
|
||||
errorMessage,
|
||||
successMessage,
|
||||
infoMessage,
|
||||
canSubmit,
|
||||
handleSubmit,
|
||||
textBtnConfirm = 'Valider',
|
||||
classBtnConfirm = '',
|
||||
children
|
||||
}: FormProps) {
|
||||
return (<>
|
||||
<Head>
|
||||
<title>Superpipo — {title}</title>
|
||||
</Head>
|
||||
<div className={`App ${styles['create-app']}`}>
|
||||
<h2>{title}</h2>
|
||||
<form onSubmit={handleSubmit}>
|
||||
{children}
|
||||
<button type='submit' className={classBtnConfirm} disabled={!canSubmit}>
|
||||
{textBtnConfirm}
|
||||
</button>
|
||||
</form>
|
||||
<Link href='/'>
|
||||
<a>← Revenir à l'accueil</a>
|
||||
</Link>
|
||||
<MessageManager
|
||||
info={infoMessage}
|
||||
error={errorMessage}
|
||||
success={successMessage}
|
||||
/>
|
||||
</div>
|
||||
</>)
|
||||
}
|
||||
Reference in New Issue
Block a user