Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
nair0lf32 committed Jul 25, 2024
1 parent 9248a66 commit 5458902
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 90 deletions.
3 changes: 3 additions & 0 deletions _data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- title: Auteurs
url: /authors

- title: Contributeurs
url: /contributors

- title: Tous les articles
url: /cheatsheets

Expand Down
89 changes: 20 additions & 69 deletions _includes/search.html
Original file line number Diff line number Diff line change
@@ -1,73 +1,24 @@
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#myInput {
background-image: url("{{ '/assets/images/icon-search.png?v=' | append: site.github.build_revision | relative_url }}");
/* Add a search icon to input */
background-position: 10px 12px;
background-repeat: no-repeat;
width: 75%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}

#myUL {
list-style-type: none;
padding: 0;
margin: 0;
}

#myUL li a {
border: 1px solid #ddd;
margin-top: -1px;
background-color: #f6f6f6;
padding: 12px;
text-decoration: none;
font-size: 18px;
color: black;
display: block;
}

#myUL li a:hover:not(.header) {
background-color: #eee;
}

.articles>h2:only-child {
display: none;
}
</style>

<head>




<body>
<input type="search" id="myInput" onkeyup="searchFunction()" placeholder="Cherchez un article..">

<script>
function searchFunction() {

var input = document.getElementById('myInput'),
filter = input.value.toUpperCase(),

//TODO: fix the selection for better search results display
li = document.querySelectorAll(".ul li");

// Loop through all list items, and hide those who don't match the search query
for (var i = 0; i < li.length; i++) {
var a = li[i].querySelector("a");

if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "block";
} else {
li[i].style.display = "none";
}
</head>

<body>
<input type="search" id="myInput" onkeyup="searchFunction()" placeholder="Cherchez un article..">
<script>
function searchFunction() {
var input = document.getElementById('myInput'),
filter = input.value.toUpperCase(),
//TODO: fix the selection for better search results display
li = document.querySelectorAll(".ul li");
// Loop through all list items, and hide those who don't match the search query
for (var i = 0; i < li.length; i++) {
var a = li[i].querySelector("a");
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "block";
} else {
li[i].style.display = "none";
}
}
</script>

</body>
}
</script>
</body>
73 changes: 73 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,79 @@ a:hover {
color: yellowgreen;
}


.about {
font-size: 1.3rem;
}

.hidden {
display: none;
}

/* The visit-button on index page */
.visit-btn {
margin-top: 5%;
display: flex;
align-self: center;
max-width: fit-content;
margin-inline: auto;
padding: 1%;
font-size: 1.3rem;
border: 1px black solid;
text-decoration: none;
outline: none;
background: none;
color: green;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.visit-btn:hover {
text-decoration: none;
background: green;
color: white;
}


/* search bar for articles */
#myInput {
display: block;
background-image: url("{{ '/assets/images/icon-search.png?v=' | append: site.github.build_revision | relative_url }}");
/* Add a search icon to input */
background-position: 10px 12px;
background-repeat: no-repeat;
width: 75%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}

#myUL {
list-style-type: none;
padding: 0;
margin: 0;
}

#myUL li a {
border: 1px solid #ddd;
margin-top: -1px;
background-color: #f6f6f6;
padding: 12px;
text-decoration: none;
font-size: 18px;
color: black;
display: block;
}

#myUL li a:hover:not(.header) {
background-color: #eee;
}

.articles>h2:only-child {
display: none;
}


/* Media queries below. handle bigger screens later */
@media screen and (max-width: 700px) {
.sidebar {
Expand Down
13 changes: 2 additions & 11 deletions cheatsheets.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,14 @@ permalink: /cheatsheets/
{% endunless %}
{% endfor %}

<style>
.hidden {
display: none;
}
</style>

<p> Actuellement <b>{{ posts }}</b> articles sont disponibles, répartis en <b>{{ categories }}</b> catégories: <p>
Actuellement <b>{{ posts }}</b> articles sont disponibles, répartis en <b>{{ categories }}</b> catégories

{% assign sortedCategories = site.categories | sort %}

{% for category in sortedCategories %}
{% unless category contains 'Menu' or category contains 'Secrets' or category contains 'Exemple'%}
{% unless category contains 'Menu' or category contains 'Exemple'%}
<div class="articles">
<h2>{{ category[0] }} ({{ category[1].size }})</h2>

<ul id="myUL" class="ul">
{% assign sortedArticles = category[1] | sort: 'title' %}
{% for post in sortedArticles %}
Expand All @@ -42,8 +35,6 @@ permalink: /cheatsheets/
{% endunless %}
{% endfor %}

<p>
Actuellement <b>{{ site.authors.size }}</b> auteur(s) ont contribué au développement de ce blog. Merci à tous ceux qui contribuent.
Vous pouvez consulter la liste des auteurs et voir leur page via le menu ou en cliquant
<a href="{{ site.baseurl }}{% link authors.markdown %}" class=""> Ici </a>
<p>
9 changes: 7 additions & 2 deletions contributions.markdown
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
- Make available in navigation when a contribution is made
- will list contributors and their contributions here (except articles writtings, see authors page for that)
---
layout: default
title: Contributeurs
permalink: /contributors/
---

Aucune contribution pour le moment
8 changes: 0 additions & 8 deletions index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,4 @@ Pour en savoir plus suivez ce lien
Bonne visite !

<div align=center style="margin-top:5%;">
<a href="{{ site.baseurl }}{% link cheatsheets.markdown %}" class="visit-btn"> Voir les articles</a>
</div>

<style>
.about{font-size:1.3rem;}
.visit-btn{padding:1%; font-size: 1.3rem; border: 1px black solid; text-decoration: none; outline: none; background: none; color: green;}
.visit-btn:hover{text-decoration: none; background:green; color:white;}
</style>

0 comments on commit 5458902

Please sign in to comment.