Highlight active icon
This commit is contained in:
parent
97a2464b14
commit
30e02f1c38
2 changed files with 26 additions and 14 deletions
|
@ -119,19 +119,31 @@ defmodule Liliform.Icon do
|
|||
color -> color
|
||||
end
|
||||
|
||||
case assigns.for do
|
||||
"alert" -> [class: "has-text-danger"]
|
||||
"info" -> [class: "has-text-info"]
|
||||
"success" -> [class: "has-text-success"]
|
||||
"warning" -> [class: "has-text-warning"]
|
||||
"error" -> [class: "has-text-danger"]
|
||||
"all" -> [color: "magenta"]
|
||||
"compute" -> [color: "blue"]
|
||||
"storage" -> [color: "green"]
|
||||
"network" -> [color: "orange"]
|
||||
"system" -> [color: "purple"]
|
||||
"account" -> [color: "darkblue"]
|
||||
_ -> [color: color]
|
||||
auto_color =
|
||||
case assigns.for do
|
||||
"alert" -> [class: "has-text-danger"]
|
||||
"info" -> [class: "has-text-info"]
|
||||
"success" -> [class: "has-text-success"]
|
||||
"warning" -> [class: "has-text-warning"]
|
||||
"error" -> [class: "has-text-danger"]
|
||||
"all" -> [color: "magenta"]
|
||||
"compute" -> [color: "blue"]
|
||||
"storage" -> [color: "green"]
|
||||
"network" -> [color: "orange"]
|
||||
"system" -> [color: "purple"]
|
||||
"account" -> [color: "darkblue"]
|
||||
_ -> [color: color]
|
||||
end
|
||||
|
||||
case color do
|
||||
"auto" ->
|
||||
auto_color
|
||||
|
||||
"" ->
|
||||
[]
|
||||
|
||||
_ ->
|
||||
[color: color]
|
||||
end
|
||||
else
|
||||
[class: "has-text-dark"]
|
||||
|
|
|
@ -50,7 +50,7 @@ defmodule Liliform.Page do
|
|||
phx-click="filter"
|
||||
phx-value-key={filter.key}
|
||||
>
|
||||
<.icon for={filter.icon} color="auto" />
|
||||
<.icon for={filter.icon} color={if filter.active, do: "gray", else: "auto"} />
|
||||
</a>
|
||||
<% end %>
|
||||
</.panel_tabs>
|
||||
|
|
Loading…
Reference in a new issue