Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Development] Integrate Simple Icons #564

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,38 @@ module.exports = {
},
{ values }
)
}),
plugin(function ({ matchComponents, theme }) {
let iconsDir = path.join(__dirname, './vendor/simple-icons')
let values = {}

fs.readdirSync(iconsDir).forEach((file) => {
let name = path.basename(file, '.svg')
values[name] = { name, fullPath: path.join(iconsDir, file) }
})

matchComponents(
{
si: ({ name, fullPath }) => {
let content = fs
.readFileSync(fullPath)
.toString()
.replace(/\r?\n|\r/g, '')
return {
[`--si-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
'-webkit-mask': `var(--si-${name})`,
mask: `var(--si-${name})`,
'mask-repeat': 'no-repeat',
'background-color': 'currentColor',
'vertical-align': 'middle',
display: 'inline-block',
width: theme('spacing.5'),
height: theme('spacing.5')
}
}
},
{ values }
)
})
]
}
1 change: 1 addition & 0 deletions assets/vendor/simple-icons/discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/vendor/simple-icons/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/pinchflat_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ defmodule PinchflatWeb.CoreComponents do
attr :class, :string, default: nil
attr :rest, :global

def icon(%{name: "hero-" <> _} = assigns) do
def icon(assigns) do
~H"""
<span class={[@name, @class]} {@rest} />
"""
Expand Down
6 changes: 4 additions & 2 deletions lib/pinchflat_web/components/layouts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ defmodule PinchflatWeb.Layouts do
attr :text, :string, required: true
attr :href, :any, required: true
attr :target, :any, default: "_self"
attr :icon_class, :string, default: ""

def sidebar_item(assigns) do
~H"""
<li class="text-bodydark1">
<.sidebar_link icon={@icon} text={@text} href={@href} target={@target} />
<.sidebar_link icon={@icon} text={@text} href={@href} target={@target} icon_class={@icon_class} />
</li>
"""
end
Expand Down Expand Up @@ -89,6 +90,7 @@ defmodule PinchflatWeb.Layouts do
attr :href, :any, required: true
attr :target, :any, default: "_self"
attr :class, :string, default: ""
attr :icon_class, :string, default: ""

def sidebar_link(assigns) do
~H"""
Expand All @@ -103,7 +105,7 @@ defmodule PinchflatWeb.Layouts do
@class
]}
>
<.icon :if={@icon} name={@icon} /> {@text}
<.icon :if={@icon} name={@icon} class={@icon_class} /> {@text}
</.link>
"""
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
text="Docs"
target="_blank"
href="https://github.com/kieraneglin/pinchflat/wiki"
icon_class="scale-110"
/>
<.sidebar_item icon="hero-cog" text="Github" target="_blank" href="https://github.com/kieraneglin/pinchflat" />
<.sidebar_item icon="si-github" text="Github" target="_blank" href="https://github.com/kieraneglin/pinchflat" />
<li>
<span
class={[
Expand All @@ -59,7 +60,7 @@
]}
phx-click={show_modal("donate-modal")}
>
<.icon name="hero-currency-dollar" /> Donate
<.icon name="hero-currency-dollar" class="scale-110" /> Donate
</span>
</li>
<li>
Expand Down
45 changes: 9 additions & 36 deletions priv/grafana/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
"limit": 100,
"name": "PromEx service start",
"showIn": 0,
"tags": [
"prom_ex",
"pinchflat",
"start"
],
"tags": ["prom_ex", "pinchflat", "start"],
"type": "tags"
},
{
Expand All @@ -33,11 +29,7 @@
"limit": 100,
"name": "PromEx service stop",
"showIn": 0,
"tags": [
"prom_ex",
"pinchflat",
"stop"
],
"tags": ["prom_ex", "pinchflat", "stop"],
"type": "tags"
}
]
Expand Down Expand Up @@ -108,9 +100,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -314,9 +304,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "/^name$/",
"values": false
},
Expand Down Expand Up @@ -370,9 +358,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "/^sha$/",
"values": false
},
Expand Down Expand Up @@ -426,9 +412,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "/^author$/",
"values": false
},
Expand Down Expand Up @@ -482,9 +466,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "/^version$/",
"values": false
},
Expand Down Expand Up @@ -538,9 +520,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "/^modules$/",
"values": false
},
Expand Down Expand Up @@ -618,17 +598,10 @@
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m"
]
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m"]
},
"timezone": "",
"title": "Pinchflat - PromEx Application Dashboard",
"uid": "7DBBC471C5775585391E8F24D1E62319",
"version": 1
}

49 changes: 10 additions & 39 deletions priv/grafana/beam.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
"limit": 100,
"name": "PromEx service start",
"showIn": 0,
"tags": [
"prom_ex",
"pinchflat",
"start"
],
"tags": ["prom_ex", "pinchflat", "start"],
"type": "tags"
},
{
Expand All @@ -33,11 +29,7 @@
"limit": 100,
"name": "PromEx service stop",
"showIn": 0,
"tags": [
"prom_ex",
"pinchflat",
"stop"
],
"tags": ["prom_ex", "pinchflat", "stop"],
"type": "tags"
}
]
Expand Down Expand Up @@ -122,9 +114,7 @@
"justifyMode": "center",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -336,9 +326,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -400,9 +388,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -650,9 +636,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -714,9 +698,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -919,9 +901,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -983,9 +963,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -2341,17 +2319,10 @@
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m"
]
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m"]
},
"timezone": "",
"title": "Pinchflat - PromEx Beam Dashboard",
"uid": "14B578642B07F5DEA133D4DE6A6AAD0A",
"version": 1
}

Loading
Loading