Skip to content

Commit ca90da4

Browse files
authored
Add simple icons (#564)
1 parent 40cde43 commit ca90da4

File tree

12 files changed

+109
-260
lines changed

12 files changed

+109
-260
lines changed

assets/tailwind.config.js

+32
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,38 @@ module.exports = {
347347
},
348348
{ values }
349349
)
350+
}),
351+
plugin(function ({ matchComponents, theme }) {
352+
let iconsDir = path.join(__dirname, './vendor/simple-icons')
353+
let values = {}
354+
355+
fs.readdirSync(iconsDir).forEach((file) => {
356+
let name = path.basename(file, '.svg')
357+
values[name] = { name, fullPath: path.join(iconsDir, file) }
358+
})
359+
360+
matchComponents(
361+
{
362+
si: ({ name, fullPath }) => {
363+
let content = fs
364+
.readFileSync(fullPath)
365+
.toString()
366+
.replace(/\r?\n|\r/g, '')
367+
return {
368+
[`--si-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
369+
'-webkit-mask': `var(--si-${name})`,
370+
mask: `var(--si-${name})`,
371+
'mask-repeat': 'no-repeat',
372+
'background-color': 'currentColor',
373+
'vertical-align': 'middle',
374+
display: 'inline-block',
375+
width: theme('spacing.5'),
376+
height: theme('spacing.5')
377+
}
378+
}
379+
},
380+
{ values }
381+
)
350382
})
351383
]
352384
}
+1
Loading

assets/vendor/simple-icons/github.svg

+1
Loading

lib/pinchflat_web/components/core_components.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ defmodule PinchflatWeb.CoreComponents do
700700
attr :class, :string, default: nil
701701
attr :rest, :global
702702

703-
def icon(%{name: "hero-" <> _} = assigns) do
703+
def icon(assigns) do
704704
~H"""
705705
<span class={[@name, @class]} {@rest} />
706706
"""

lib/pinchflat_web/components/layouts.ex

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ defmodule PinchflatWeb.Layouts do
1515
attr :text, :string, required: true
1616
attr :href, :any, required: true
1717
attr :target, :any, default: "_self"
18+
attr :icon_class, :string, default: ""
1819

1920
def sidebar_item(assigns) do
2021
~H"""
2122
<li class="text-bodydark1">
22-
<.sidebar_link icon={@icon} text={@text} href={@href} target={@target} />
23+
<.sidebar_link icon={@icon} text={@text} href={@href} target={@target} icon_class={@icon_class} />
2324
</li>
2425
"""
2526
end
@@ -89,6 +90,7 @@ defmodule PinchflatWeb.Layouts do
8990
attr :href, :any, required: true
9091
attr :target, :any, default: "_self"
9192
attr :class, :string, default: ""
93+
attr :icon_class, :string, default: ""
9294

9395
def sidebar_link(assigns) do
9496
~H"""
@@ -103,7 +105,7 @@ defmodule PinchflatWeb.Layouts do
103105
@class
104106
]}
105107
>
106-
<.icon :if={@icon} name={@icon} /> {@text}
108+
<.icon :if={@icon} name={@icon} class={@icon_class} /> {@text}
107109
</.link>
108110
"""
109111
end

lib/pinchflat_web/components/layouts/partials/sidebar.html.heex

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@
4747
text="Docs"
4848
target="_blank"
4949
href="https://github.com/kieraneglin/pinchflat/wiki"
50+
icon_class="scale-110"
5051
/>
51-
<.sidebar_item icon="hero-cog" text="Github" target="_blank" href="https://github.com/kieraneglin/pinchflat" />
52+
<.sidebar_item icon="si-github" text="Github" target="_blank" href="https://github.com/kieraneglin/pinchflat" />
5253
<li>
5354
<span
5455
class={[
@@ -59,7 +60,7 @@
5960
]}
6061
phx-click={show_modal("donate-modal")}
6162
>
62-
<.icon name="hero-currency-dollar" /> Donate
63+
<.icon name="hero-currency-dollar" class="scale-110" /> Donate
6364
</span>
6465
</li>
6566
<li>

priv/grafana/application.json

+9-36
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
"limit": 100,
1919
"name": "PromEx service start",
2020
"showIn": 0,
21-
"tags": [
22-
"prom_ex",
23-
"pinchflat",
24-
"start"
25-
],
21+
"tags": ["prom_ex", "pinchflat", "start"],
2622
"type": "tags"
2723
},
2824
{
@@ -33,11 +29,7 @@
3329
"limit": 100,
3430
"name": "PromEx service stop",
3531
"showIn": 0,
36-
"tags": [
37-
"prom_ex",
38-
"pinchflat",
39-
"stop"
40-
],
32+
"tags": ["prom_ex", "pinchflat", "stop"],
4133
"type": "tags"
4234
}
4335
]
@@ -108,9 +100,7 @@
108100
"justifyMode": "auto",
109101
"orientation": "auto",
110102
"reduceOptions": {
111-
"calcs": [
112-
"last"
113-
],
103+
"calcs": ["last"],
114104
"fields": "",
115105
"values": false
116106
},
@@ -314,9 +304,7 @@
314304
"justifyMode": "auto",
315305
"orientation": "auto",
316306
"reduceOptions": {
317-
"calcs": [
318-
"last"
319-
],
307+
"calcs": ["last"],
320308
"fields": "/^name$/",
321309
"values": false
322310
},
@@ -370,9 +358,7 @@
370358
"justifyMode": "auto",
371359
"orientation": "auto",
372360
"reduceOptions": {
373-
"calcs": [
374-
"last"
375-
],
361+
"calcs": ["last"],
376362
"fields": "/^sha$/",
377363
"values": false
378364
},
@@ -426,9 +412,7 @@
426412
"justifyMode": "auto",
427413
"orientation": "auto",
428414
"reduceOptions": {
429-
"calcs": [
430-
"last"
431-
],
415+
"calcs": ["last"],
432416
"fields": "/^author$/",
433417
"values": false
434418
},
@@ -482,9 +466,7 @@
482466
"justifyMode": "auto",
483467
"orientation": "auto",
484468
"reduceOptions": {
485-
"calcs": [
486-
"last"
487-
],
469+
"calcs": ["last"],
488470
"fields": "/^version$/",
489471
"values": false
490472
},
@@ -538,9 +520,7 @@
538520
"justifyMode": "auto",
539521
"orientation": "auto",
540522
"reduceOptions": {
541-
"calcs": [
542-
"last"
543-
],
523+
"calcs": ["last"],
544524
"fields": "/^modules$/",
545525
"values": false
546526
},
@@ -618,17 +598,10 @@
618598
"to": "now"
619599
},
620600
"timepicker": {
621-
"refresh_intervals": [
622-
"5s",
623-
"10s",
624-
"30s",
625-
"1m",
626-
"5m"
627-
]
601+
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m"]
628602
},
629603
"timezone": "",
630604
"title": "Pinchflat - PromEx Application Dashboard",
631605
"uid": "7DBBC471C5775585391E8F24D1E62319",
632606
"version": 1
633607
}
634-

priv/grafana/beam.json

+10-39
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
"limit": 100,
1919
"name": "PromEx service start",
2020
"showIn": 0,
21-
"tags": [
22-
"prom_ex",
23-
"pinchflat",
24-
"start"
25-
],
21+
"tags": ["prom_ex", "pinchflat", "start"],
2622
"type": "tags"
2723
},
2824
{
@@ -33,11 +29,7 @@
3329
"limit": 100,
3430
"name": "PromEx service stop",
3531
"showIn": 0,
36-
"tags": [
37-
"prom_ex",
38-
"pinchflat",
39-
"stop"
40-
],
32+
"tags": ["prom_ex", "pinchflat", "stop"],
4133
"type": "tags"
4234
}
4335
]
@@ -122,9 +114,7 @@
122114
"justifyMode": "center",
123115
"orientation": "auto",
124116
"reduceOptions": {
125-
"calcs": [
126-
"last"
127-
],
117+
"calcs": ["last"],
128118
"fields": "",
129119
"values": false
130120
},
@@ -336,9 +326,7 @@
336326
"justifyMode": "auto",
337327
"orientation": "auto",
338328
"reduceOptions": {
339-
"calcs": [
340-
"lastNotNull"
341-
],
329+
"calcs": ["lastNotNull"],
342330
"fields": "",
343331
"values": false
344332
},
@@ -400,9 +388,7 @@
400388
"justifyMode": "auto",
401389
"orientation": "auto",
402390
"reduceOptions": {
403-
"calcs": [
404-
"last"
405-
],
391+
"calcs": ["last"],
406392
"fields": "",
407393
"values": false
408394
},
@@ -650,9 +636,7 @@
650636
"justifyMode": "auto",
651637
"orientation": "auto",
652638
"reduceOptions": {
653-
"calcs": [
654-
"last"
655-
],
639+
"calcs": ["last"],
656640
"fields": "",
657641
"values": false
658642
},
@@ -714,9 +698,7 @@
714698
"justifyMode": "auto",
715699
"orientation": "auto",
716700
"reduceOptions": {
717-
"calcs": [
718-
"last"
719-
],
701+
"calcs": ["last"],
720702
"fields": "",
721703
"values": false
722704
},
@@ -919,9 +901,7 @@
919901
"justifyMode": "auto",
920902
"orientation": "auto",
921903
"reduceOptions": {
922-
"calcs": [
923-
"last"
924-
],
904+
"calcs": ["last"],
925905
"fields": "",
926906
"values": false
927907
},
@@ -983,9 +963,7 @@
983963
"justifyMode": "auto",
984964
"orientation": "auto",
985965
"reduceOptions": {
986-
"calcs": [
987-
"last"
988-
],
966+
"calcs": ["last"],
989967
"fields": "",
990968
"values": false
991969
},
@@ -2341,17 +2319,10 @@
23412319
"to": "now"
23422320
},
23432321
"timepicker": {
2344-
"refresh_intervals": [
2345-
"5s",
2346-
"10s",
2347-
"30s",
2348-
"1m",
2349-
"5m"
2350-
]
2322+
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m"]
23512323
},
23522324
"timezone": "",
23532325
"title": "Pinchflat - PromEx Beam Dashboard",
23542326
"uid": "14B578642B07F5DEA133D4DE6A6AAD0A",
23552327
"version": 1
23562328
}
2357-

0 commit comments

Comments
 (0)