Skip to content

Commit 7244bdc

Browse files
refactor: use GeneralDialog in character stats table (#6963)
* use GeneralDialog * remove unused import * remove redundant margin * reduce button size
1 parent 441e2b7 commit 7244bdc

4 files changed

Lines changed: 29 additions & 177 deletions

File tree

lua/wikis/commons/Widget/CharacterStats/DetailsPopup.lua

Lines changed: 0 additions & 48 deletions
This file was deleted.

lua/wikis/commons/Widget/CharacterStats/DetailsPopup/Container.lua

Lines changed: 0 additions & 70 deletions
This file was deleted.

lua/wikis/commons/Widget/CharacterStats/Table.lua

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ local Table = Lua.import('Module:Table')
2020

2121
local Widget = Lua.import('Module:Widget')
2222
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
23+
local Button = Lua.import('Module:Widget/Basic/Button')
2324
local DataTable = Lua.import('Module:Widget/Basic/DataTable')
24-
local DetailsPopup = Lua.import('Module:Widget/CharacterStats/DetailsPopup')
25-
local DetailsPopupContainer = Lua.import('Module:Widget/CharacterStats/DetailsPopup/Container')
25+
local Dialog = Lua.import('Module:Widget/Basic/Dialog')
2626
local Link = Lua.import('Module:Widget/Basic/Link')
2727
local WidgetUtil = Lua.import('Module:Widget/Util')
2828

@@ -155,20 +155,23 @@ function CharacterStatsTable:_buildCharacterRow(characterData, characterIndex)
155155
characterData.total.pick + characterData.bans, self.props.numGames
156156
)}
157157
} or nil,
158-
HtmlWidgets.Td{children = DetailsPopupContainer{
159-
children = DetailsPopup{
160-
header = CharacterIcon.Icon{
161-
character = characterData.name,
162-
size = self.props.characterSize,
163-
addTextLink = true
164-
} .. ' Detailed Statistics',
165-
children = HtmlWidgets.Div{
166-
classes = {'character-stats-popup-info'},
167-
children = {
168-
CharacterStatsTable._buildPlayedByTeamTable(characterData.playedBy),
169-
self:_buildPlayedTable('with', characterData.playedWith),
170-
self:_buildPlayedTable('against', characterData.playedVs)
171-
}
158+
HtmlWidgets.Td{children = Dialog{
159+
trigger = Button{
160+
children = 'Show',
161+
variant = 'secondary',
162+
size = 'xs',
163+
},
164+
title = CharacterIcon.Icon{
165+
character = characterData.name,
166+
size = self.props.characterSize,
167+
addTextLink = true
168+
} .. ' Detailed Statistics',
169+
children = HtmlWidgets.Div{
170+
classes = {'character-stats-popup-info'},
171+
children = {
172+
CharacterStatsTable._buildPlayedByTeamTable(characterData.playedBy),
173+
self:_buildPlayedTable('with', characterData.playedWith),
174+
self:_buildPlayedTable('against', characterData.playedVs)
172175
}
173176
}
174177
}}

stylesheets/commons/Statisticstable.scss

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,48 +25,15 @@ tr.character-stats-row > td {
2525
width: 30px;
2626
}
2727

28-
.character-stats-popup {
29-
border: 1px solid #bbbbbb;
30-
width: calc( 100% - 1rem );
31-
background-color: #ffffff;
32-
position: absolute;
33-
left: 0.5rem;
34-
margin-top: 1.5rem;
35-
border-radius: 0.5rem;
36-
box-shadow: 0 0.0625rem 0.25rem 0 var( --clr-on-surface-dark-primary-12 );
37-
padding: 0.5rem;
38-
39-
.theme--dark & {
40-
background-color: var( --clr-secondary-16 );
41-
border-color: var( --clr-on-surface-dark-primary-8 );
42-
}
43-
44-
&-header {
45-
font-size: 20px;
46-
font-weight: bold;
47-
}
48-
49-
&-info {
50-
display: flex;
51-
gap: 0.5rem;
52-
justify-content: center;
53-
flex-wrap: wrap;
54-
margin-top: 0.5rem;
55-
56-
> div {
57-
display: inline-block;
58-
flex: auto;
59-
vertical-align: top;
60-
}
61-
}
62-
63-
&-button {
64-
background: #d3d3d3;
65-
background-color: #d3d3d3 !important;
66-
border: 0 !important;
67-
box-shadow: 2px 2px 2px rgba( 0, 0, 0, 0.1 );
68-
font-size: 10px;
69-
overflow: hidden;
70-
height: 15px !important;
28+
.character-stats-popup-info {
29+
display: flex;
30+
gap: 0.5rem;
31+
justify-content: center;
32+
flex-wrap: wrap;
33+
34+
> div {
35+
display: inline-block;
36+
flex: auto;
37+
vertical-align: top;
7138
}
7239
}

0 commit comments

Comments
 (0)