iconfont.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Tabler Icons - version <%= v %></title>
  9. <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600" rel="stylesheet">
  10. <link rel="stylesheet" href="./<%= fileName %>.css">
  11. <style>
  12. * { margin: 0; border: 0; outline: 0; box-sizing: border-box; }
  13. body {
  14. font-family: 'Open Sans', sans-serif;
  15. background: #fafbfc;
  16. font-size: 1rem;
  17. padding: 1rem;
  18. }
  19. code {
  20. font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
  21. background: #fafafa;
  22. border: 1px solid #f0f0f0;
  23. color: #666;
  24. padding: 2px 4px;
  25. margin-bottom: 2px;
  26. }
  27. .container {
  28. max-width: 73rem;
  29. margin: 0 auto;
  30. }
  31. .box {
  32. padding: 1rem;
  33. background: #fff;
  34. box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 1px 1px rgba(0, 0, 0, .1);
  35. border-radius: 3px;
  36. border-top-right-radius: 0;
  37. border-top-left-radius: 0;
  38. }
  39. .tabler-icons {
  40. display: flex;
  41. flex-wrap: wrap;
  42. justify-content: space-between;
  43. }
  44. .tabler-icon {
  45. width: 10rem;
  46. font-size: 12px;
  47. text-align: center;
  48. padding: .5rem .25rem 2rem;
  49. }
  50. .tabler-icon i {
  51. display: block;
  52. align-items: center;
  53. font-size: 32px;
  54. height: 1em;
  55. margin-bottom: 1rem;
  56. }
  57. .tabler-icon code {
  58. font-size: 10px;
  59. }
  60. .tabler-icon strong {
  61. display: block;
  62. margin-bottom: .5rem;
  63. }
  64. .tabler-icon-codes {
  65. line-height: 2em;
  66. }
  67. .text-muted {
  68. color: #999;
  69. }
  70. .header {
  71. text-align: center;
  72. margin: 2rem 0 3rem;
  73. }
  74. .search-bar {
  75. padding: 0.75rem 1.5rem;
  76. background: #fff;
  77. box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 1px 1px rgba(0, 0, 0, .1);
  78. border-radius: 3px;
  79. border-bottom-left-radius: 0px;
  80. border-bottom-right-radius: 0px;
  81. }
  82. .search-bar input[name=search]{
  83. padding:0.5rem;
  84. background: #fafbfc;
  85. box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 1px 1px rgba(0, 0, 0, .1);
  86. width:100%;
  87. }
  88. </style>
  89. </head>
  90. <body>
  91. <div class="container">
  92. <header class="header">
  93. <h1>
  94. Tabler Icons
  95. </h1>
  96. <p class="text-muted">version <%= v %></p>
  97. </header>
  98. <div class="search-bar">
  99. <input type="text" name="search" placeholder="type to search"/>
  100. </div>
  101. <div class="box">
  102. <div class="tabler-icons">
  103. <% glyphs.forEach(function(glyph) { %>
  104. <div class="tabler-icon">
  105. <i class="ti ti-<%= glyph.name %>"></i>
  106. <strong><%= glyph.name %></strong>
  107. <div class="tabler-icon-codes">
  108. <code>ti ti-<%= glyph.name %></code><br>
  109. <code>\<%= glyph.unicode[0].codePointAt(0).toString(16) %></code>
  110. </div>
  111. </div>
  112. <% }) %>
  113. </div>
  114. </div>
  115. </div>
  116. <script type="text/javascript">
  117. const input = document.querySelector("div.search-bar input");
  118. const iconContainer = document.querySelector("div.box div.tabler-icons");
  119. let icons = [];
  120. document.querySelectorAll("div.tabler-icon").forEach(icon => icons.push({
  121. el : icon,
  122. name : icon.querySelector('strong').innerHTML,
  123. }));
  124. input.addEventListener('input', search);
  125. function search(evt){
  126. let searchValue = evt.target.value;
  127. let iconsToShow = searchValue.length ? icons.filter(icon => icon.name.includes(searchValue)) : icons;
  128. iconContainer.innerHTML = "";
  129. iconsToShow.forEach(icon => iconContainer.appendChild(icon.el));
  130. }
  131. </script>
  132. </body>
  133. </html>