aboutsummaryrefslogtreecommitdiff
path: root/src/editor.html
blob: ba2ddf7a267dc9fd4bf03ec4ccf572bebf4a0978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
---
layout: default
---

<div class="container">
	<div class="box">

		{% assign icons = site.icons %}

		{% assign first-icon = site.icons | reverse | first %}
		{% assign slug = first-icon.slug %}
		{% capture first-icon %}
		{% include_cached icon.html name=slug %}
		{% endcapture %}

		<div class="row mb js-icon-manager">
			<div class="col">

				<div class="icon-preview-wrap">
					<div class="icon-preview">
						{{ first-icon }}
						{{ first-icon }}
					</div>
				</div>
			</div>
			<div class="col-aside">

				<h1 class="icon-title js-icon-name">{{ slug }}</h1>

				<div class="mb">
					<button class="btn">
						{{ first-icon }} Button
					</button>
					<button class="btn btn-icon">
						{{ first-icon }}
					</button>
					<button class="btn btn-link">
						{{ first-icon }} Button
					</button>
				</div>

				<div class="input-icon mb">
					<input type="text" class="input" value="Input value">
					{{ first-icon }}
				</div>

				<div class="input-icon icon-left mb">
					{{ first-icon }}
					<input type="text" class="input" placeholder="Input placeholder">
				</div>

				<div class="mb">
					<div class="avatar">{{ first-icon }}</div>
					<div class="avatar avatar-sm">{{ first-icon }}</div>

					<a href="#">{{ first-icon }} Link</a>
				</div>

				<div class="tabs mb">
					<a class="tab active">{{ first-icon }} Tab 1</a>
					<a class="tab">Tab 2</a>
					<a class="tab">Tab 3</a>
				</div>

				<div class="mb">
					<textarea rows="10" class="input js-textarea"></textarea>
				</div>


				<div class="mt-auto">
					<input class="input-range js-input-range" type="range" min="1.25" max="2.75" step=".25" value="2">
				</div>

			</div>
		</div>

		<div class="mb">
			{% 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' %}
		</div>

		{% assign new-icons = icons | where: "version", null %}

		{% if new-icons %}
		<h2 class="icon-subtitle">New icons ({{ new-icons | size }})</h2>

		<div class="mb">
			<div class="icons-list">

				{% for icon in new-icons %}
				{% assign name = icon.slug %}
				<a href="#" class="icons-list-icon js-icon" title="{{ icon.slug }}" data-icon="{{ name }}"{% unless icon.category %} style="color: #999" {% endunless %}>
					{% include_cached icon.html name=name %}
				</a>
				{% endfor %}
			</div>
		</div>
		{% endif %}

		<h2 class="icon-subtitle">{{ site.icons.size }} icons</h2>

		{% assign icons = icons | group_by: "category" %}

		<div class="mb">

			{% for category in icons %}

			{% if category.name %}
			<h3 class="category-subtitle">{% if category.name != "" %}{{ category.name }}{% else %}Uncategorized{% endif %} <span class="text-muted">({{ category.items | size }})</span></h3>
			{% endif %}

			<div class="icons-list">

				{% for icon in category.items %}
				{% assign name = icon.slug %}
				<a href="#" class="icons-list-icon js-icon{% unless icon.version %} new-icon{% endunless %}" title="{{ icon.slug }}" data-icon="{{ name }}">
					{% include_cached icon.html name=name %}
				</a>
				{% endfor %}
			</div>
			{% endfor %}
		</div>
	</div>
</div>

<script>
	$(document).ready(function () {
		$('body')
			.on('click', '.js-icon', function (e) {
				var icon = $(this).attr('data-icon');

				$('.js-icon').removeClass('active');
				$(this).addClass('active');

				$('.js-icon-name').html(icon);
				localStorage.setItem('icon', icon);

				$('.js-icon-manager svg').replaceWith($(this).find('>svg:eq(0)').clone());

				$('.js-textarea').val($(this)[0].innerHTML.trim());

				e.preventDefault();
				return false;
			})
			.on('input', '.js-input-range', function (e) {
				$('.js-icon svg').css('stroke-width', $(this).val());

				e.preventDefault();
				return false;
			});


		var icon = localStorage.getItem('icon');
		if (icon) {
			$('.js-icon[data-icon="' + icon + '"]').eq(0).click();
		}
	});
</script>