From 769b6802e73cf125e15f4a0862b476bdbd821eac Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Thu, 11 Apr 2024 12:40:58 +0200 Subject: [PATCH] feat(squad): use FA for icons (#4165) * feat(squad): use FA for icons * alt is not applicable to this...... --- components/squad/commons/squad_row.lua | 6 +++--- standard/icon.lua | 9 ++++++++- standard/icon_data.lua | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/components/squad/commons/squad_row.lua b/components/squad/commons/squad_row.lua index 31094e4de5f..c2c8bc0d6fe 100644 --- a/components/squad/commons/squad_row.lua +++ b/components/squad/commons/squad_row.lua @@ -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') @@ -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 diff --git a/standard/icon.lua b/standard/icon.lua index ad556f2d6d4..4b542e0ed7a 100644 --- a/standard/icon.lua +++ b/standard/icon.lua @@ -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()] diff --git a/standard/icon_data.lua b/standard/icon_data.lua index 8d0efc1db3d..a086a6239c7 100644 --- a/standard/icon_data.lua +++ b/standard/icon_data.lua @@ -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', }