Browse Source

Styles Css, merci l'ia

Sangfroid 5 months ago
parent
commit
51548cbbc3

+ 3 - 0
assets/app.js

@@ -8,3 +8,6 @@ import './bootstrap.js';
 
 
 import './styles/app.css';
+import './styles/forms.css';
+import './styles/badges.css';
+import './styles/buttons.css';

BIN
assets/images/landscape.jpg


BIN
assets/images/landscape.save.jpg


+ 91 - 81
assets/styles/app.css

@@ -17,6 +17,11 @@
 body {
   margin: 0;
   padding: 0;
+  background-color: rgb(38, 26, 51);
+  background-image: url(../images/landscape.jpg);
+  background-size: cover;
+  background-attachment: fixed;
+  background-position-y: 0;
 }
 
 header * {
@@ -27,10 +32,8 @@ header * {
 }
 
 header {
-  height: 40vh;
+  height: 200px;
   width: 100vw;
-  background-image: url(../images/landscape.jpg);
-  background-size: cover;
   transition: all 0.1s ease;
 }
 
@@ -85,85 +88,16 @@ header {
   flex-direction: column;
 }
 
-@media screen and (max-width: 1400px) {
-  header {
-    height: 50vh;
-  }
-}
-
-@media screen and (max-width: 900px) {
-  header.big {
-    height: 100vh;
-  }
-
-  .navbar {
-    padding: 0;
-    position: absolute;
-  }
-
-  .nav-links {
-    top: 0;
-    left: 0;
-    position: absolute;
-    background-color: rgba(0, 255, 221, 0.308);
-    width: 100%;
-    height: 100vh;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    backdrop-filter: blur(7px);
-    margin-left: -100%;
-    transition: all 0.1s ease;
-  }
-
-  .nav-links ul {
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-  }
-
-  .navbar .menu-burger {
-    display: block;
-  }
-  .nav-links.mobile-menu {
-    margin-left: 0;
-  }
-
-  .navbar .nav-links > ul > li {
-    margin: 25px 0;
-    font-size: 1.2em;
-  }
-
-  .navbar .nav-links ul li {
-    flex-direction: column;
-  }
-
-  .navbar .logo {
-    position: absolute;
-    top: 40px;
-    left: 30px;
-    font-size: 2em;
-  }
-
-  header {
-    height: 30vh;
-  }
-
-  /* Body */
- 
-}
-
-
-
 /* Body */
 main {
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  width: 100%; /* S'assure que le main ne dépasse pas la largeur de l'écran */
+  width: 100%;
   box-sizing: border-box;
-  flex-wrap: wrap;
-  padding: 10px;
+  margin: 0 auto;
+  max-width: 900px;
+  background-color: white;
+  padding: 0 30px;
+  border-radius: 15px;
+  min-height: 70vh;
 }
 
 img, .contenu-flex {
@@ -177,7 +111,7 @@ img, .contenu-flex {
 }
 
 .article-preview {
-  max-height: 400px; /* Hauteur maximale pour chaque article */
+  max-height: 600px; /* Hauteur maximale pour chaque article */
   overflow: hidden; /* Masque le contenu qui dépasse */
   position: relative; /* Nécessaire pour le gradient ou autre effet de coupure */
   margin-bottom: 30px;
@@ -226,4 +160,80 @@ main h2 a:hover {
 
 .table-articles {
   width: 100%;
-}
+}
+
+
+
+
+
+
+
+@media screen and (max-width: 1400px) {
+  header {
+    height: 250px;
+  }
+}
+
+@media screen and (max-width: 900px) {
+  header.big {
+    height: 100vh;
+  }
+
+  .navbar {
+    padding: 0;
+    position: absolute;
+  }
+
+  .nav-links {
+    top: 0;
+    left: 0;
+    position: absolute;
+    background-color: rgba(0, 255, 221, 0.308);
+    width: 100%;
+    height: 100vh;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    backdrop-filter: blur(7px);
+    margin-left: -100%;
+    transition: all 0.1s ease;
+  }
+
+  .nav-links ul {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+  }
+
+  .navbar .menu-burger {
+    display: block;
+  }
+  .nav-links.mobile-menu {
+    margin-left: 0;
+  }
+
+  .navbar .nav-links > ul > li {
+    margin: 25px 0;
+    font-size: 1.2em;
+  }
+
+  .navbar .nav-links ul li {
+    flex-direction: column;
+  }
+
+  .navbar .logo {
+    position: absolute;
+    top: 40px;
+    left: 30px;
+    font-size: 2em;
+  }
+
+  header {
+    height: 30vh;
+  }
+  
+  main {
+    padding: 0 20px;
+   
+  }
+}

+ 32 - 0
assets/styles/badges.css

@@ -0,0 +1,32 @@
+/* Style de base pour tous les badges */
+.badge {
+  display: inline-block;
+  padding: 5px 10px;
+  font-size: 12px;
+  font-weight: bold;
+  border-radius: 12px;
+  text-transform: uppercase;
+  color: #fff;
+  margin-right: 5px;
+}
+
+/* Badge pour l'état "Publié" */
+.badge-published {
+  background-color: #28a745; /* Vert */
+}
+
+/* Badge pour l'état "Brouillon" */
+.badge-draft {
+  background-color: #ffc107; /* Jaune */
+  color: #333; /* Couleur du texte sur fond jaune */
+}
+
+/* Badge pour l'état "En révision" */
+.badge-review {
+  background-color: #17a2b8; /* Bleu clair */
+}
+
+/* Badge pour l'état "Archivé" */
+.badge-rejected {
+  background-color: #c40928; /* Rouge */
+}

+ 42 - 0
assets/styles/buttons.css

@@ -0,0 +1,42 @@
+/* Style de base pour tous les boutons */
+.btn {
+    display: inline-block;
+    padding: 10px 20px;
+    font-size: 16px;
+    font-weight: bold;
+    text-align: center;
+    text-decoration: none;
+    border-radius: 5px;
+    border: none;
+    color: #fff;
+    cursor: pointer;
+    transition: background-color 0.3s ease-in-out;
+  }
+  
+  /* Bouton vert (succès) */
+  .btn-green {
+    background-color: #28a745; /* Vert */
+  }
+  
+  .btn-green:hover {
+    background-color: #218838; /* Vert plus foncé au survol */
+  }
+  
+  /* Bouton bleu (info ou action) */
+  .btn-blue {
+    background-color: #007bff; /* Bleu */
+  }
+  
+  .btn-blue:hover {
+    background-color: #0069d9; /* Bleu plus foncé au survol */
+  }
+  
+  /* Bouton rouge (danger ou alerte) */
+  .btn-red {
+    background-color: #dc3545; /* Rouge */
+  }
+  
+  .btn-red:hover {
+    background-color: #c82333; /* Rouge plus foncé au survol */
+  }
+  

+ 123 - 0
assets/styles/forms.css

@@ -0,0 +1,123 @@
+/* Style global du formulaire */
+form {
+    max-width: 600px;
+    margin: 50px auto;
+    padding: 20px;
+    background-color: #f9f9f9;
+    border-radius: 8px;
+    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+    font-family: 'Arial', sans-serif;
+  }
+  
+  /* Style pour les labels */
+  form label {
+    display: block;
+    font-weight: bold;
+    margin-bottom: 8px;
+    color: #333;
+  }
+  
+  /* Style pour les champs de saisie */
+  form input[type="text"],
+  form input[type="email"],
+  form input[type="password"],
+  form textarea,
+  form select {
+    width: 100%;
+    padding: 12px;
+    margin-bottom: 20px;
+    border: 1px solid #ccc;
+    border-radius: 4px;
+    background-color: #fff;
+    font-size: 16px;
+    box-sizing: border-box;
+    transition: border-color 0.3s ease-in-out;
+  }
+  
+  /* Style pour les erreurs (si Symfony utilise des classes pour les erreurs) */
+  form .is-invalid {
+    border-color: #e74c3c;
+  }
+  
+  form .is-invalid + .invalid-feedback {
+    color: #e74c3c;
+    font-size: 0.875rem;
+  }
+  
+  /* Focus pour améliorer l'expérience utilisateur */
+  form input[type="text"]:focus,
+  form input[type="email"]:focus,
+  form input[type="password"]:focus,
+  form textarea:focus,
+  form select:focus {
+    border-color: #007bff;
+    outline: none;
+    box-shadow: 0 0 8px rgba(0, 123, 255, 0.25);
+  }
+  
+  /* Style pour les textarea */
+  form textarea {
+    min-height: 150px;
+    resize: vertical; /* Permet de redimensionner verticalement seulement */
+  }
+  
+  /* Style pour les boutons */
+  form button[type="submit"],
+  form input[type="submit"] {
+    display: inline-block;
+    width: 100%;
+    padding: 12px;
+    font-size: 16px;
+    font-weight: bold;
+    color: #fff;
+    background-color: #007bff;
+    border: none;
+    border-radius: 4px;
+    cursor: pointer;
+    transition: background-color 0.3s ease-in-out;
+  }
+  
+  form button[type="submit"]:hover,
+  form input[type="submit"]:hover {
+    background-color: #0056b3;
+  }
+  
+  /* Style pour les cases à cocher et les boutons radio */
+  form input[type="checkbox"],
+  form input[type="radio"] {
+    margin-right: 10px;
+  }
+  
+  /* Wrapper pour les cases à cocher et radio */
+  .form-check {
+    margin-bottom: 20px;
+  }
+  
+  .form-check-label {
+    display: inline-block;
+    color: #333;
+  }
+  
+  /* Style pour les messages d'erreur (champ obligatoire, etc.) */
+  .invalid-feedback {
+    color: #e74c3c;
+    margin-top: -15px;
+    margin-bottom: 10px;
+    font-size: 0.875rem;
+  }
+  
+  /* Message de succès */
+  form .success-message {
+    color: #28a745;
+    font-size: 1rem;
+    margin-bottom: 20px;
+    display: none;
+  }
+  
+  /* Style pour les selects */
+  form select {
+    appearance: none;
+    background: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="none" stroke="%23333" stroke-width=".5" d="M2 0L0 2h4z"/></svg>') no-repeat right 10px center;
+    background-size: 12px;
+  }
+  

+ 1 - 1
composer.json

@@ -78,7 +78,7 @@
     "scripts": {
         "auto-scripts": {
             "cache:clear": "symfony-cmd",
-            "ckeditor:install --clear=drop --release=basic --tag=4.22.1": "symfony-cmd",
+            "ckeditor:install --clear=drop --release=standard --tag=4.22.1": "symfony-cmd",
             "assets:install %PUBLIC_DIR%": "symfony-cmd",
             "importmap:install": "symfony-cmd"
         },

+ 1 - 1
config/packages/twig.yaml

@@ -1,7 +1,7 @@
 twig:
     file_name_pattern: '*.twig'
-    form_themes: ['tailwind_2_layout.html.twig']
 
 when@test:
     twig:
         strict_variables: true
+    

+ 1 - 1
templates/_menu.html.twig

@@ -1,6 +1,6 @@
 <header>
     <nav class="navbar" data-controller="menuburger">
-        <a href="#" class="logo">Opinions sur le réel</a>
+        <a href="{{ path('app_index') }}" class="logo">Opinions sur le réel</a>
         <div class="nav-links" data-menuburger-target="navlinks">
             <ul>
                 <li><a href="{{ path('app_index') }}">Blog</a></li>

+ 1 - 1
templates/article/_delete_form.html.twig

@@ -1,4 +1,4 @@
 <form method="post" action="{{ path('app_article_delete', {'id': article.id}) }}" onsubmit="return confirm('Êtes-vous certain de vouloir supprimer cet article ?');">
     <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ article.id) }}">
-    <button class="btn btn-danger">Supprimer</button>
+    <button class="btn btn-red">Supprimer</button>
 </form>

+ 2 - 2
templates/article/_form.html.twig

@@ -1,8 +1,8 @@
 <p>
-    {{ article.state | trans }}
+    Etat de l'article : <span class="badge badge-{{ article.state }}">{{ article.state | trans }}</span>
 </p>
 
 {{ form_start(form) }}
     {{ form_widget(form) }}
-    <button class="btn btn-success">{{ button_label|default('Sauvegarder') }}</button>
+    <button class="btn btn-green">{{ button_label|default('Sauvegarder') }}</button>
 {{ form_end(form) }}

+ 1 - 1
templates/article/edit.html.twig

@@ -5,7 +5,7 @@
 {% block body %}
     <h1>Editer un article</h1>
 
-    {{ include('article/_form.html.twig', {'button_label': 'Update'}) }}
+    {{ include('article/_form.html.twig', {'button_label': 'Mettre à jour'}) }}
 
     <a href="{{ path('app_article_index') }}">Retour à la liste</a>
 

+ 2 - 2
templates/article/index.html.twig

@@ -23,7 +23,7 @@
                 <td>{{ article.id }}</td>
                 <td>{{ article.title }}</td>
                 <td>{{ article.publicationDate ? article.publicationDate|date('Y-m-d H:i:s') : '' }}</td>
-                <td>{{ article.state | trans }}</td>
+                <td><span class="badge badge-{{ article.state }}">{{ article.state | trans }}</span></td>
                 <td>
                     {% if is_granted('view', article) %}
                     <a href="{{ path('app_article_show', {'id': article.id}) }}">Voir</a>
@@ -43,7 +43,7 @@
         </tbody>
     </table>
 
-    <a class="btn btn-primary" href="{{ path('app_article_new') }}">Créer un nouvel article</a>
+    <a class="btn btn-blue" href="{{ path('app_article_new') }}">Créer un nouvel article</a>
 
 </div>
 {% endblock %}

+ 1 - 1
templates/article/show.html.twig

@@ -21,7 +21,7 @@
             </tr>
             <tr>
                 <th>Etat</th>
-                <td>{{ article.state | trans }}</td>
+                <td><span class="badge badge-{{ article.state }}">{{ article.state | trans }}</span></td>
             </tr>
             <tr>
                 <th>Content</th>

+ 1 - 1
templates/security/login.html.twig

@@ -34,7 +34,7 @@
             </div>
         #}
 
-        <button class="btn btn-lg btn-primary" type="submit">
+        <button class="btn btn-lg btn-blue" type="submit">
             Sign in
         </button>
     </form>