Highlight active icon

This commit is contained in:
Harshad Sharma 2024-05-16 18:50:54 +05:30
parent 97a2464b14
commit 30e02f1c38
2 changed files with 26 additions and 14 deletions

View file

@ -119,19 +119,31 @@ defmodule Liliform.Icon do
color -> color color -> color
end end
case assigns.for do auto_color =
"alert" -> [class: "has-text-danger"] case assigns.for do
"info" -> [class: "has-text-info"] "alert" -> [class: "has-text-danger"]
"success" -> [class: "has-text-success"] "info" -> [class: "has-text-info"]
"warning" -> [class: "has-text-warning"] "success" -> [class: "has-text-success"]
"error" -> [class: "has-text-danger"] "warning" -> [class: "has-text-warning"]
"all" -> [color: "magenta"] "error" -> [class: "has-text-danger"]
"compute" -> [color: "blue"] "all" -> [color: "magenta"]
"storage" -> [color: "green"] "compute" -> [color: "blue"]
"network" -> [color: "orange"] "storage" -> [color: "green"]
"system" -> [color: "purple"] "network" -> [color: "orange"]
"account" -> [color: "darkblue"] "system" -> [color: "purple"]
_ -> [color: color] "account" -> [color: "darkblue"]
_ -> [color: color]
end
case color do
"auto" ->
auto_color
"" ->
[]
_ ->
[color: color]
end end
else else
[class: "has-text-dark"] [class: "has-text-dark"]

View file

@ -50,7 +50,7 @@ defmodule Liliform.Page do
phx-click="filter" phx-click="filter"
phx-value-key={filter.key} phx-value-key={filter.key}
> >
<.icon for={filter.icon} color="auto" /> <.icon for={filter.icon} color={if filter.active, do: "gray", else: "auto"} />
</a> </a>
<% end %> <% end %>
</.panel_tabs> </.panel_tabs>