editor.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. ---
  2. layout: default
  3. ---
  4. <div class="container">
  5. <div class="box">
  6. {% assign icons = site.icons %}
  7. {% assign first-icon = site.icons | reverse | first %}
  8. {% assign slug = first-icon.slug %}
  9. {% capture first-icon %}
  10. {% include_cached icon.html name=slug %}
  11. {% endcapture %}
  12. <div class="row mb js-icon-manager">
  13. <div class="col">
  14. <div class="icon-preview-wrap">
  15. <div class="icon-preview">
  16. {{ first-icon }}
  17. {{ first-icon }}
  18. </div>
  19. </div>
  20. </div>
  21. <div class="col-aside">
  22. <h1 class="icon-title js-icon-name">{{ slug }}</h1>
  23. <div class="mb">
  24. <button class="btn">
  25. {{ first-icon }} Button
  26. </button>
  27. <button class="btn btn-icon">
  28. {{ first-icon }}
  29. </button>
  30. <button class="btn btn-link">
  31. {{ first-icon }} Button
  32. </button>
  33. </div>
  34. <div class="input-icon mb">
  35. <input type="text" class="input" value="Input value">
  36. {{ first-icon }}
  37. </div>
  38. <div class="input-icon icon-left mb">
  39. {{ first-icon }}
  40. <input type="text" class="input" placeholder="Input placeholder">
  41. </div>
  42. <div class="mb">
  43. <div class="avatar">{{ first-icon }}</div>
  44. <div class="avatar avatar-sm">{{ first-icon }}</div>
  45. <a href="#">{{ first-icon }} Link</a>
  46. </div>
  47. <div class="tabs mb">
  48. <a class="tab active">{{ first-icon }} Tab 1</a>
  49. <a class="tab">Tab 2</a>
  50. <a class="tab">Tab 3</a>
  51. </div>
  52. <div class="mb">
  53. <textarea rows="10" class="input js-textarea"></textarea>
  54. </div>
  55. <div class="mt-auto">
  56. <input class="input-range js-input-range" type="range" min="1.25" max="2.75" step=".25" value="2">
  57. </div>
  58. </div>
  59. </div>
  60. <div class="mb">
  61. {% include_cached toolbar.html toolbar='arrow-back-up,arrow-forward-up,printer,paint|bold,italic,underline,strikethrough,emphasis,baseline|align-left,align-center,align-right,align-justified,line-height|list,list-check,list-numbers|h-1,h-2,h-3,h-4,h-5,h-6,link,photo,table,regex|sort-ascending,sort-descending,sort-ascending-letters,sort-ascending-numbers|indent-increase,indent-decrease|subscript,superscript|minus,omega,chart-area-line,pencil|eraser,settings,typography,letters-case,clear-formatting|parentheses,brackets,braces,terminal|bike,run,swimming,walk,pray,fall,karate|heart,spade,diamonds,clubs|repeat,repeat-once,switch,player-record,player-play,player-pause,player-stop,power,player-skip-forward,player-skip-back,player-track-next,player-track-prev,player-eject' %}
  62. </div>
  63. {% assign new-icons = icons | where: "version", null %}
  64. {% if new-icons %}
  65. <h2 class="icon-subtitle">New icons ({{ new-icons | size }})</h2>
  66. <div class="mb">
  67. <div class="icons-list">
  68. {% for icon in new-icons %}
  69. {% assign name = icon.slug %}
  70. <a href="#" class="icons-list-icon js-icon" title="{{ icon.slug }}" data-icon="{{ name }}"{% unless icon.category %} style="color: #999" {% endunless %}>
  71. {% include_cached icon.html name=name %}
  72. </a>
  73. {% endfor %}
  74. </div>
  75. </div>
  76. {% endif %}
  77. <h2 class="icon-subtitle">{{ site.icons.size }} icons</h2>
  78. {% assign icons = icons | group_by: "category" %}
  79. <div class="mb">
  80. {% for category in icons %}
  81. {% if category.name %}
  82. <h3 class="category-subtitle">{% if category.name != "" %}{{ category.name }}{% else %}Uncategorized{% endif %} <span class="text-muted">({{ category.items | size }})</span></h3>
  83. {% endif %}
  84. <div class="icons-list">
  85. {% for icon in category.items %}
  86. {% assign name = icon.slug %}
  87. <a href="#" class="icons-list-icon js-icon{% unless icon.version %} new-icon{% endunless %}" title="{{ icon.slug }}" data-icon="{{ name }}">
  88. {% include_cached icon.html name=name %}
  89. </a>
  90. {% endfor %}
  91. </div>
  92. {% endfor %}
  93. </div>
  94. </div>
  95. </div>
  96. <script>
  97. $(document).ready(function () {
  98. $('body')
  99. .on('click', '.js-icon', function (e) {
  100. var icon = $(this).attr('data-icon');
  101. $('.js-icon').removeClass('active');
  102. $(this).addClass('active');
  103. $('.js-icon-name').html(icon);
  104. localStorage.setItem('icon', icon);
  105. $('.js-icon-manager svg').replaceWith($(this).find('>svg:eq(0)').clone());
  106. $('.js-textarea').val($(this)[0].innerHTML.trim());
  107. e.preventDefault();
  108. return false;
  109. })
  110. .on('input', '.js-input-range', function (e) {
  111. $('.js-icon svg').css('stroke-width', $(this).val());
  112. e.preventDefault();
  113. return false;
  114. });
  115. var icon = localStorage.getItem('icon');
  116. if (icon) {
  117. $('.js-icon[data-icon="' + icon + '"]').eq(0).click();
  118. }
  119. });
  120. </script>