Skip to content

Commit

Permalink
feat(squad): use FA for icons (#4165)
Browse files Browse the repository at this point in the history
* feat(squad): use FA for icons

* alt is not applicable to this......
  • Loading branch information
Rathoz authored Apr 11, 2024
1 parent bc9fa3e commit 769b680
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/squad/commons/squad_row.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

local Class = require('Module:Class')
local Flags = require('Module:Flags')
local Icon = require('Module:Icon')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local OpponentLib = require('Module:OpponentLibraries')
Expand All @@ -22,9 +23,8 @@ local Variables = require('Module:Variables')
local SquadUtils = Lua.import('Module:Squad/Utils')
local Widget = Lua.import('Module:Infobox/Widget/All')

local ICON_CAPTAIN = '[[File:Captain Icon.png|18px|baseline|Captain|link=Category:Captains|alt=Captain'
.. '|class=player-role-icon]]'
local ICON_SUBSTITUTE = '[[File:Substitution.png|18px|baseline|Sub|link=|alt=Substitution|class=player-role-icon]]'
local ICON_CAPTAIN = Icon.makeIcon{iconName = 'captain', hover = 'Captain'}
local ICON_SUBSTITUTE = Icon.makeIcon{iconName = 'substitute', hover = 'Substitute'}

---@class SquadRow
---@operator call: SquadRow
Expand Down
9 changes: 8 additions & 1 deletion standard/icon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ local Logic = require('Module:Logic')

local Icon = {}

---@param args {iconName: string, color: string?, screenReaderHidden: boolean?, hover: string?, size: integer|string?}
---@class IconArgs
---@field iconName string
---@field color string?
---@field screenReaderHidden boolean?
---@field hover string?
---@field size integer|string|nil

---@param args IconArgs
---@return string?
function Icon.makeIcon(args)
local icon = IconData[(args.iconName or ''):lower()]
Expand Down
4 changes: 4 additions & 0 deletions standard/icon_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ return {

-- Usage: buildtime, duration, cooldown, ...
time = 'far fa-clock',

-- Usage: Sqaud Table
captain = 'fas fa-crown',
substitute = 'fas fa-people-arrows',
}

0 comments on commit 769b680

Please sign in to comment.