diff --git a/components/match2/wikis/dota2/match_summary.lua b/components/match2/wikis/dota2/match_summary.lua index 87aead1fa41..1aded6aa7fd 100644 --- a/components/match2/wikis/dota2/match_summary.lua +++ b/components/match2/wikis/dota2/match_summary.lua @@ -118,9 +118,8 @@ function CustomMatchSummary.createBody(match) end if MatchPage.isEnabledFor(match) then - body:addRow(MatchSummary.Row():addElement( - MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId} - )) + body.root:node(MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId}) + end -- Iterate each map diff --git a/components/match2/wikis/leagueoflegends/match_summary.lua b/components/match2/wikis/leagueoflegends/match_summary.lua index 3312359f6af..9e79ef504ed 100644 --- a/components/match2/wikis/leagueoflegends/match_summary.lua +++ b/components/match2/wikis/leagueoflegends/match_summary.lua @@ -58,9 +58,7 @@ function CustomMatchSummary.createBody(match) end if MatchPage.isEnabledFor(match) then - body:addRow(MatchSummary.Row():addElement( - MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId} - )) + body.root:node(MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId}) end -- Iterate each map diff --git a/components/widget/match/summary/widget_match_summary_match_page_link.lua b/components/widget/match/summary/widget_match_summary_match_page_link.lua index 48d8b597232..9529a621b1a 100644 --- a/components/widget/match/summary/widget_match_summary_match_page_link.lua +++ b/components/widget/match/summary/widget_match_summary_match_page_link.lua @@ -13,6 +13,7 @@ local Widget = Lua.import('Module:Widget') local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Div, Center = HtmlWidgets.Div, HtmlWidgets.Center local Link = Lua.import('Module:Widget/Basic/Link') +local MatchSummaryRow = Lua.import('Module:Widget/Match/Summary/Row') ---@class MatchSummaryMatchPageLink: Widget ---@operator call(table): MatchSummaryMatchPageLink @@ -24,16 +25,12 @@ function MatchSummaryMatchPageLink:render() return end - return Div{classes = {'brkts-popup-mvp'}, css = {['font-size'] = '85%'}, children = Center{children = - Link{ - link = 'Match:ID_' .. self.props.matchId, - children = 'Match Page', - css = { - display = 'block', - margin = 'auto', - }, + return MatchSummaryRow{classes = {'brkts-popup-mvp'}, css = {['font-size'] = '85%'}, children = + Center{ + children = Link{link = 'Match:ID_' .. self.props.matchId, children = 'Match Page'}, + css = {display = 'block', margin = 'auto'}, } - }} + } end return MatchSummaryMatchPageLink diff --git a/components/widget/match/summary/widget_match_summary_row.lua b/components/widget/match/summary/widget_match_summary_row.lua new file mode 100644 index 00000000000..d4fba89aceb --- /dev/null +++ b/components/widget/match/summary/widget_match_summary_row.lua @@ -0,0 +1,32 @@ +--- +-- @Liquipedia +-- wiki=commons +-- page=Module:Widget/Match/Summary/Row +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Class = require('Module:Class') +local Lua = require('Module:Lua') + +local Widget = Lua.import('Module:Widget') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') +local Div = HtmlWidgets.Div + +---@class MatchSummaryRow: Widget +---@operator call(table): MatchSummaryRow +local MatchSummaryRow = Class.new(Widget) +MatchSummaryRow.defaultProps = { + classes = {}, +} + +---@return Widget +function MatchSummaryRow:render() + return Div{ + classes = {'brkts-popup-body-element', unpack(self.props.classes)}, + css = self.props.css, + children = self.props.children, + } +end + +return MatchSummaryRow