Skip to content

Commit bda1033

Browse files
kilianpaquierKilian PAQUIERSnailedltlunatic-fox
authored
new feature: icons number (#1267)
* new feature: icons number - fix #1218 * icon numbers| review suggestions application Co-authored-by: Snailedlt <Snailedlt@users.noreply.github.com> * Change shield link to https://devicon.dev * add titles and rename logos & icons to icons & icon-versions * replace = with : Co-authored-by: Josélio Júnior <76992016+lunatic-fox@users.noreply.github.com> * fixed avg fonts number to integer and added float in title * Update docs/index.html Co-authored-by: Josélio Júnior <76992016+lunatic-fox@users.noreply.github.com> --------- Co-authored-by: Kilian PAQUIER <contact@kilian-paquier.fr> Co-authored-by: Snailedlt <Snailedlt@users.noreply.github.com> Co-authored-by: Jørgen Kalsnes Hagen <43886029+Snailedlt@users.noreply.github.com> Co-authored-by: Josélio Júnior <76992016+lunatic-fox@users.noreply.github.com>
1 parent 771daeb commit bda1033

4 files changed

Lines changed: 40 additions & 4 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<a href="https://github.com/devicons/devicon/stargazers">
1818
<img alt="GitHub repository stars" src="https://img.shields.io/github/stars/devicons/devicon?color=%2360be86&label=github%20stars&style=for-the-badge">
1919
</a>
20+
<a href="https://devicon.dev/">
21+
<img alt="Registered logos" src="https://img.shields.io/github/directory-file-count/devicons/devicon/icons?color=%2360be86&label=registered%20logos&style=for-the-badge">
22+
</a>
2023
</p>
2124
<br />
2225
<div align="center">

docs/assets/css/style.css

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,29 @@ input[type='color']:hover {
415415
.main {
416416
margin: 0 0 0 480px; }
417417

418-
.search {
418+
.result {
419+
max-width: 75px;
420+
}
421+
422+
.computed-data {
423+
color: var(--primaryColor);
424+
font-weight: bold;
425+
list-style: none;
426+
padding: 0;
427+
width: 80%;
428+
margin: 25px auto;
429+
display: flex;
430+
}
431+
432+
.computed-data li {
433+
width: 33.33%;
419434
text-align: center; }
435+
436+
.search {
437+
text-align: center;
438+
margin: 4rem 0 1rem 0; }
439+
420440
.search input {
421-
width: 300px;
422-
margin: 4rem;
423441
padding: .5rem 1rem;
424442
border: 0;
425443
border-bottom: 2px solid var(--primaryColor);

docs/assets/js/script.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
3838
$scope.icons = [];
3939
$scope.selectedIcon = {};
4040

41+
// Miscellaneous stuff
42+
$scope.totalFonts = 0; // Total fonts and SVGs combined
43+
4144
// background color related stuff
4245
// default is the default site background color
4346
$scope.DEFAULT_BACKGROUND = "#3D9561";
@@ -61,6 +64,8 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
6164
main: ""
6265
};
6366

67+
$scope.totalFonts += devicon.versions.font.length + devicon.versions.svg.length;
68+
6469
// Loop through devicon.json icons
6570
for (var i = 0; i < devicon.versions.font.length; i++) {
6671

@@ -96,6 +101,9 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
96101
$scope.selectedFontIndex = 0;
97102
$scope.selectedSvgIndex = 0;
98103

104+
// Computes miscellaneous data
105+
$scope.avgFonts = $scope.totalFonts / $scope.icons.length // Avg number of fonts and SVGs combined
106+
99107
/*------ End of "Re-format devicon.json" ------*/
100108
});
101109

docs/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,17 @@ <h5>If you have any legal concerns regarding copyrights or want to report an abu
203203

204204
<div class="search">
205205
<input type="text" placeholder="Search for icons" ng-model="search">
206+
<input type="text" class="result" value="{{ filtered.length }}" title="Number of icons in the current search" disabled>
206207
</div>
207208

209+
<ul class="computed-data">
210+
<li title="The number of icons.&#xA;For example: devicon">Total icons: {{ icons.length }}</li>
211+
<li title="The number of icon versions.&#xA;For example: devicon-plain">Total icon version: {{ totalFonts }}</li>
212+
<li title="The number of icon versions per icon.&#xA;Calculated by dividing icon version by icons: {{ avgFonts.toFixed(2) }}">Average icon versions per icon: {{ avgFonts.toFixed(0) }}</li>
213+
</ul>
214+
208215
<ul class="cbp-ig-grid">
209-
<li ng-repeat="icon in icons | filter:search">
216+
<li data-ng-repeat="icon in filtered = (icons | filter:search)">
210217
<span ng-class="{'selected': icon.selected}" ng-click="selectIcon(icon)">
211218
<i class="cbp-ig-icon devicon-{{icon.main}}"></i>
212219
<h3 class="cbp-ig-title">{{icon.name}}</h3>

0 commit comments

Comments
 (0)