From 3e92f3a4af350a65205b8df6c9b156ee1acdaf2f Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Mon, 14 Oct 2024 09:49:51 +0200 Subject: [PATCH 1/4] refactor: migrate several widgets to v2 system --- .../widget/{ => basic}/widget_button.lua | 64 ++++++++++--------- .../widget/{ => basic}/widget_data_table.lua | 0 components/widget/basic/widget_link.lua | 51 +++++++++++++++ components/widget/{ => image}/widget_icon.lua | 11 +--- .../{ => image}/widget_icon_fontawesome.lua | 10 +-- .../widget/{ => image}/widget_icon_image.lua | 12 +--- .../widget_inline_icon_and_text.lua | 44 +++++-------- components/widget/widget_link.lua | 39 ----------- 8 files changed, 110 insertions(+), 121 deletions(-) rename components/widget/{ => basic}/widget_button.lua (53%) rename components/widget/{ => basic}/widget_data_table.lua (100%) create mode 100644 components/widget/basic/widget_link.lua rename components/widget/{ => image}/widget_icon.lua (70%) rename components/widget/{ => image}/widget_icon_fontawesome.lua (75%) rename components/widget/{ => image}/widget_icon_image.lua (77%) rename components/widget/{ => misc}/widget_inline_icon_and_text.lua (52%) delete mode 100644 components/widget/widget_link.lua diff --git a/components/widget/widget_button.lua b/components/widget/basic/widget_button.lua similarity index 53% rename from components/widget/widget_button.lua rename to components/widget/basic/widget_button.lua index 767276a364c..9713a76b900 100644 --- a/components/widget/widget_button.lua +++ b/components/widget/basic/widget_button.lua @@ -14,7 +14,7 @@ local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Link = Lua.import('Module:Widget/Link') local Div = HtmlWidgets.Div ----@class ButtonWidgetParameters: WidgetParameters +---@class ButtonWidgetParameters ---@field title string? ---@field link string? ---@field linktype 'internal'|'external'|nil @@ -23,11 +23,6 @@ local Div = HtmlWidgets.Div ---@class ButtonWidget: Widget ---@operator call(ButtonWidgetParameters): ButtonWidget ----@field title string? ----@field link string? ----@field linktype 'internal'|'external' ----@field variant 'primary'|'secondary'|'ghost' ----@field size 'sm'|'md'|'lg' local Button = Class.new( Widget, @@ -40,39 +35,48 @@ local Button = Class.new( end ) ----@param children string[] ----@return string -function Button:make(children) - --- MW Parser does not allowed the