Skip to content

Commit b207815

Browse files
committed
styles
1 parent 7623c72 commit b207815

File tree

6 files changed

+28
-17
lines changed

6 files changed

+28
-17
lines changed

public/css/style.css

+13-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
body.light-theme {
88
background-color: var(--light);
99
color: var(--dark);
10-
transition: 0.5s;
10+
transition: .5s;
1111
}
1212

1313
body.dark-theme {
@@ -18,28 +18,34 @@ body.dark-theme {
1818

1919
/* style de la page */
2020

21-
nav{
21+
.header{
2222
display: flex;
2323
flex: row nowrap ;
2424
width: 100%;
25+
align-items: center;
26+
}
27+
28+
.nav{
29+
display: block;
30+
width: 90%;
2531
}
2632
.menu-liste{
2733
display: flex;
2834
flex: row nowrap ;
29-
justify-content: space-between;
35+
justify-content: flex-start;
3036

3137
list-style: none;
3238
}
3339

40+
.menu-liste-items{
41+
margin: 0.5rem 1rem 0;
42+
}
3443

44+
.btn-menu{
3545

36-
.theme-switch{
37-
align-self: flex-end;
3846
}
3947

4048
/* transitions */
41-
/* message de chargement de la page */
42-
4349
th:hover{
4450
background-color: var(--grey);
4551
}

public/js/main.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
document.addEventListener('DOMContentLoaded', function () {
22
const themeToggleBtn = document.getElementById('themeToggleBtn');
3+
const table = document.getElementsByClassName('table');
34
const body = document.body;
45

56
// on regarde si l'utilisateur avait le thème sombre à la dernière visite sur la page ou avant de la rafraîchir
@@ -14,12 +15,12 @@ document.addEventListener('DOMContentLoaded', function () {
1415
}
1516

1617
// écouteurs d'évènements
17-
themeToggleBtn.addEventListener('click', function () {
18+
themeToggleBtn.addEventListener('click', function(){
1819
body.classList.toggle('light-theme');
1920
body.classList.toggle('dark-theme');
2021
themeToggleBtn.classList.remove('btn-primary');
2122

22-
setTimeout(function () {
23+
setTimeout(function(){
2324
themeToggleBtn.classList.toggle(
2425
'btn-dark',
2526
body.classList.contains('light-theme'));
@@ -29,8 +30,13 @@ document.addEventListener('DOMContentLoaded', function () {
2930
body.classList.contains('dark-theme'));
3031

3132
themeToggleBtn.innerText = body.classList.contains('dark-theme') ? 'Mode clair' : 'Mode sombre';
33+
34+
3235
}, 200);
3336

37+
for (var i = 0; i < table.length; i++){
38+
table[i].classList.toggle('text-light');
39+
}
3440

3541
// on enregistre le choix de l'utilisateur (pour que le thème reste le même quand il revient)
3642
const currentTheme = body.classList.contains('dark-theme') ? 'dark-theme' : 'light-theme';

templates/article/index.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
</tbody>
4141
</table>
4242
<div class="d-flex justify-content-center">
43-
<a class="btn btn-outline-primary btn-lg" href="{{ path('article_new') }}">Create new article</a>
43+
<a class="btn btn-primary btn-lg" href="{{ path('article_new') }}">Create new article</a>
4444
</div>
4545
{% endblock %}

templates/article_search/index.html.twig

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
{# Message si aucun articles #}
3434
{% else %}
3535
<h2 class="mt-6">Aucun résultats </h2>
36-
<h2 class="mt-6">Aucun résultats</h2>
3736
{% endif %}
3837
</div>
3938
</div>

templates/category/index.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
</table>
3434

3535

36-
<a class="btn btn-outline-primary btn-lg" href="{{ path('category_new') }}">Create new category</a>
36+
<a class="btn btn-primary btn-lg" href="{{ path('category_new') }}">Create new category</a>
3737
{% endblock %}

templates/menu/index.html.twig

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{# menu/index.html.twig #}
22

3-
<header>
4-
<nav>
3+
<header class="header">
4+
<nav class="nav">
55
<ul class="menu-liste">
6-
<li class="menu-liste-items btn"><a href="{{ path('article_index') }}">Articles</a></li>
7-
<li class="menu-liste-items btn"><a href="{{ path('category_index') }}">Categories</a></li>
8-
<li class="menu-liste-items btn"><a href="{{ path('article_search') }}">Rechercher un article</a></li>
6+
<li class="menu-liste-items"><a class="btn btn-primary btn-menu" href="{{ path('article_index') }}">Articles</a></li>
7+
<li class="menu-liste-items"><a class="btn btn-primary btn-menu" href="{{ path('category_index') }}">Categories</a></li>
8+
<li class="menu-liste-items"><a class="btn btn-primary btn-menu" href="{{ path('article_search') }}">Rechercher un article</a></li>
99
</ul>
1010
</nav>
1111
<button class="btn btn-dark theme-switch" id="themeToggleBtn">Mode sombre</button>

0 commit comments

Comments
 (0)