Files
cv-generator/index.html
T
2026-04-05 13:00:11 +01:00

385 lines
9.7 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CV Generator</title>
<style>
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: #0f0f0f;
color: #e0e0e0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
padding: 20px;
}
.container {
max-width: 520px;
width: 100%;
}
header {
text-align: center;
margin-bottom: 32px;
}
h1 {
font-size: 2.2rem;
font-weight: 700;
color: #e94560;
margin-bottom: 10px;
}
header p {
color: #a0a0b0;
font-size: 0.95rem;
}
.card {
background: #16213e;
border: 1px solid #2a2a4a;
border-radius: 12px;
padding: 32px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
font-size: 0.85rem;
color: #a0a0b0;
margin-bottom: 6px;
font-weight: 500;
letter-spacing: 0.03em;
}
input {
width: 100%;
padding: 11px 14px;
background: #1a1a2e;
border: 1px solid #2a2a4a;
border-radius: 6px;
color: #e0e0e0;
font-size: 0.95rem;
outline: none;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input::placeholder {
color: #4a4a6a;
}
input:focus {
border-color: #e94560;
box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}
.btn-generate {
width: 100%;
background: #e94560;
color: #fff;
border: none;
padding: 13px;
border-radius: 6px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
margin-top: 8px;
transition: background 0.2s ease;
}
.btn-generate:hover {
background: #f05a73;
}
.success-message {
display: none;
color: #4caf50;
text-align: center;
padding-top: 16px;
font-size: 0.95rem;
}
footer {
text-align: center;
margin-top: 28px;
font-size: 0.8rem;
color: #4a4a6a;
}
/* --- Section Formations --- */
.section-title {
font-size: 1.1rem;
font-weight: 600;
color: #e94560;
margin-bottom: 16px;
padding-bottom: 8px;
border-bottom: 1px solid #2a2a4a;
}
.section-formations {
margin-bottom: 28px;
}
.formation-item {
background: #1a1a2e;
border: 1px solid #2a2a4a;
border-radius: 8px;
padding: 16px;
margin-bottom: 12px;
position: relative;
}
.form-row {
display: flex;
gap: 12px;
}
.form-row .form-group {
flex: 1;
}
.btn-remove {
position: absolute;
top: 10px;
right: 10px;
background: transparent;
border: 1px solid #4a4a6a;
color: #a0a0b0;
border-radius: 4px;
width: 24px;
height: 24px;
font-size: 0.75rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: border-color 0.2s ease, color 0.2s ease;
}
.btn-remove:hover {
border-color: #e94560;
color: #e94560;
}
.btn-add {
background: transparent;
color: #e94560;
border: 1px dashed #e94560;
border-radius: 6px;
padding: 9px 16px;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
width: 100%;
margin-top: 4px;
transition: background 0.2s ease, color 0.2s ease;
}
.btn-add:hover {
background: rgba(233, 69, 96, 0.08);
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>CV Generator</h1>
<p>Remplissez vos informations pour générer votre CV</p>
</header>
<div class="card">
<form id="cv-form" novalidate>
<div class="form-group">
<label for="nom">Nom</label>
<input
type="text"
id="nom"
name="nom"
placeholder="Dupont"
autocomplete="family-name"
required
minlength="1"
aria-required="true"
>
</div>
<div class="form-group">
<label for="prenom">Prénom</label>
<input
type="text"
id="prenom"
name="prenom"
placeholder="Jean"
autocomplete="given-name"
required
minlength="1"
aria-required="true"
>
</div>
<div class="form-group">
<label for="email">Email</label>
<input
type="email"
id="email"
name="email"
placeholder="jean.dupont@email.com"
autocomplete="email"
required
aria-required="true"
>
</div>
<div class="form-group">
<label for="titre">Titre du poste</label>
<input
type="text"
id="titre"
name="titre"
placeholder="Développeur Full Stack"
autocomplete="organization-title"
required
minlength="1"
aria-required="true"
>
</div>
<!-- Section Formations -->
<div class="section-formations">
<h2 class="section-title">Formations</h2>
<div id="formations-list">
<div class="formation-item">
<div class="form-row">
<div class="form-group">
<label for="formation-diplome-0">Diplôme / Titre</label>
<input
type="text"
id="formation-diplome-0"
name="formation-diplome[]"
placeholder="ex: Master Informatique"
>
</div>
<div class="form-group">
<label for="formation-etablissement-0">Établissement</label>
<input
type="text"
id="formation-etablissement-0"
name="formation-etablissement[]"
placeholder="ex: Université Paris-Saclay"
>
</div>
</div>
<div class="form-group">
<label for="formation-annee-0">Année d'obtention</label>
<input
type="text"
id="formation-annee-0"
name="formation-annee[]"
placeholder="ex: 2023"
pattern="[0-9]{4}"
title="Entrez une année à 4 chiffres"
>
</div>
</div>
</div>
<button type="button" class="btn-add" id="add-formation">+ Ajouter une formation</button>
</div>
<button type="submit" class="btn-generate">Générer mon CV</button>
<p class="success-message" id="success"></p>
</form>
</div>
<footer>
<p>CV Generator &copy; 2026</p>
</footer>
</div>
<script>
document.getElementById('cv-form').addEventListener('submit', function(e) {
e.preventDefault();
const nom = document.getElementById('nom').value.trim();
const prenom = document.getElementById('prenom').value.trim();
const email = document.getElementById('email').value.trim();
const titre = document.getElementById('titre').value.trim();
if (!nom || !prenom || !email || !titre) return;
const formData = { nom, prenom, email, titre };
localStorage.setItem('cvData', JSON.stringify(formData));
const success = document.getElementById('success');
success.textContent = `CV prêt à être généré pour ${prenom} ${nom} !`;
success.style.display = 'block';
console.log('Données du CV :', formData);
});
// Gestion des formations dynamiques
let formationCount = 1;
document.getElementById('add-formation').addEventListener('click', function () {
const list = document.getElementById('formations-list');
const index = formationCount++;
const item = document.createElement('div');
item.className = 'formation-item';
item.innerHTML = `
<button type="button" class="btn-remove" aria-label="Supprimer cette formation">✕</button>
<div class="form-row">
<div class="form-group">
<label for="formation-diplome-${index}">Diplôme / Titre</label>
<input
type="text"
id="formation-diplome-${index}"
name="formation-diplome[]"
placeholder="ex: Master Informatique"
>
</div>
<div class="form-group">
<label for="formation-etablissement-${index}">Établissement</label>
<input
type="text"
id="formation-etablissement-${index}"
name="formation-etablissement[]"
placeholder="ex: Université Paris-Saclay"
>
</div>
</div>
<div class="form-group">
<label for="formation-annee-${index}">Année d'obtention</label>
<input
type="text"
id="formation-annee-${index}"
name="formation-annee[]"
placeholder="ex: 2023"
pattern="[0-9]{4}"
title="Entrez une année à 4 chiffres"
>
</div>
`;
item.querySelector('.btn-remove').addEventListener('click', function () {
this.closest('.formation-item').remove();
});
list.appendChild(item);
});
</script>
</body>
</html>