Skip to content

Commit 17f20a6

Browse files
Merge pull request #1179 from Kobzol/compare-design
Improve design of compare site
2 parents 5d9e294 + 92c512f commit 17f20a6

File tree

1 file changed

+67
-16
lines changed

1 file changed

+67
-16
lines changed

site/static/compare.html

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,26 @@
108108

109109
#states-list {
110110
display: flex;
111-
justify-content: space-around;
112-
align-items: center;
113-
width: 80%;
111+
flex-direction: column;
112+
align-items: start;
114113
list-style: none;
115114
margin: 0;
115+
padding: 0;
116+
}
117+
.section-scenarios {
118+
flex-direction: column;
119+
}
120+
121+
@media (min-width: 760px) {
122+
#states-list {
123+
justify-content: space-around;
124+
flex-direction: row;
125+
align-items: center;
126+
width: 80%;
127+
}
128+
.section-scenarios {
129+
flex-direction: row;
130+
}
116131
}
117132

118133
.tooltip {
@@ -221,14 +236,41 @@
221236
border-radius: 6px;
222237
}
223238

239+
.summary-container {
240+
display: flex;
241+
flex-direction: column;
242+
margin-bottom: 10px;
243+
}
224244
.summary {
225245
display: flex;
226-
justify-content: center;
227-
align-items: center;
228-
width: 20%;
229246
}
230-
.summary-wide {
231-
width: 35%;
247+
.summary-values {
248+
display: flex;
249+
flex-direction: column;
250+
}
251+
@media (min-width: 650px) {
252+
.summary-container {
253+
flex-direction: row;
254+
margin-bottom: 0;
255+
align-items: center;
256+
}
257+
.summary-container > span {
258+
text-align: right;
259+
width: 20%;
260+
}
261+
.summary-values {
262+
width: 100%;
263+
flex-direction: row;
264+
justify-content: flex-end;
265+
align-items: center;
266+
}
267+
.summary {
268+
width: 15%;
269+
align-items: center;
270+
}
271+
.summary-wide {
272+
width: 20%;
273+
}
232274
}
233275
</style>
234276
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
@@ -303,7 +345,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
303345
<div class="section-heading">Filter</div>
304346
<input id="filter" type="text" v-model="filter.name" />
305347
</div>
306-
<div class=" section">
348+
<div class="section section-scenarios">
307349
<div class="section-heading">
308350
<div style="width: 160px;">
309351
<span>Scenarios</span>
@@ -406,10 +448,19 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
406448
<p v-if="dataLoading && !data">Loading ...</p>
407449
<div v-if="data" id="content" style="margin-top: 15px">
408450
<div id="summary">
409-
<div v-for="summaryPair in Object.entries(summary)" style="display: flex;">
410-
<span style="font-weight: bold; width: 30%; margin-left: 15%; text-transform: capitalize;">{{
451+
<div style="display: flex; justify-content: end;">
452+
<span class="tooltip" style="margin-right: 1em;">?
453+
<span class="tooltiptext">
454+
The percents show arithmetic mean amongst regressions, amongst improvements
455+
and finally amongst all benchmarks in each category (all benchmarks or
456+
filtered benchmarks).
457+
</span>
458+
</span>
459+
</div>
460+
<div v-for="summaryPair in Object.entries(summary)" class="summary-container">
461+
<span style="font-weight: bold; margin-left: 5px; text-transform: capitalize;">{{
411462
summaryPair[0] }}:</span>
412-
<div style="display: flex; justify-content: flex-end; width: 80%; margin-right: 5%;">
463+
<div class="summary-values">
413464
<span class="summary summary-wide positive">
414465
{{summaryPair[1].regressions.toString().padStart(3, "&nbsp;")}}
415466
<svg style="width:18px;height:18px" viewBox="0 0 24 24">
@@ -435,7 +486,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
435486
&nbsp;({{(summaryPair[1].improvements_avg).toFixed(2)}}%)
436487
</span>
437488
<span class="summary" v-bind:class="percentClass(summaryPair[1].average)">
438-
&nbsp;{{ signIfNegative(summaryPair[1].average) }}{{ (summaryPair[1].average).toFixed(2) }}%
489+
&nbsp;{{ signIfPositive(summaryPair[1].average) }}{{ (summaryPair[1].average).toFixed(2) }}%
439490
</span>
440491
</div>
441492
</div>
@@ -768,11 +819,11 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
768819
prLink(pr) {
769820
return `https://github.com/rust-lang/rust/pull/${pr}`;
770821
},
771-
signIfNegative(pct) {
822+
signIfPositive(pct) {
772823
if (pct >= 0) {
773-
return "";
824+
return "+";
774825
}
775-
return "-";
826+
return "";
776827
},
777828
percentClass(pct) {
778829
let klass = "";

0 commit comments

Comments
 (0)