Skip to content

Commit 5d983d2

Browse files
author
DanielRyanSmith
committed
Add better mobile layout for interop dashboard
1 parent 235dff1 commit 5d983d2

File tree

4 files changed

+76
-16
lines changed

4 files changed

+76
-16
lines changed

webapp/components/interop-dashboard.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,6 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
291291
margin: 0 1em;
292292
}
293293
}
294-
295-
/* TODO(danielrsmith): This is a workaround to avoid the text scaling that
296-
* happens for p tags on mobile, but not for any other text (like the focus area table).
297-
* Remove this when deeper mobile functionality has been added. */
298-
p {
299-
text-size-adjust: none;
300-
}
301-
302294
</style>
303295
<div class="previous-year-banner" hidden$=[[isCurrentYear]]>
304296
<p>

webapp/components/interop-summary.js

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class InteropSummary extends PolymerElement {
2929
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400&display=swap" rel="stylesheet">
3030
3131
<style>
32-
#summaryNumberRow {
32+
.summary-number-row {
3333
display: flex;
3434
justify-content: center;
3535
gap: 30px;
@@ -92,9 +92,39 @@ class InteropSummary extends PolymerElement {
9292
.summary-browser-name:not([data-stable-browsers]) > .stable {
9393
display: none;
9494
}
95+
96+
/* Media Query for Mobile Devices */
97+
@media (max-width: 768px) {
98+
.summary-container {
99+
min-height: 340px;
100+
}
101+
102+
.summary-number {
103+
font-size: 2em;
104+
width: 2.5ch;
105+
height: 2.5ch;
106+
padding: 5px;
107+
}
108+
109+
#totalSummaryRow > .summary-flex-item > .summary-number {
110+
font-size: 4em;
111+
width: 2.5ch;
112+
height: 2.5ch;
113+
padding: 4px;
114+
}
115+
116+
.browser-score {
117+
font-size: 2em;
118+
}
119+
120+
.summary-browser-name > figure > figcaption {
121+
line-height: 1.1;
122+
margin: 0 -10px;
123+
}
124+
}
95125
</style>
96126
<div class="summary-container">
97-
<div id="summaryNumberRow">
127+
<div class="summary-number-row" id="totalSummaryRow">
98128
<!-- Interop -->
99129
<div id="interopSummary" class="summary-flex-item" tabindex="0">
100130
<div class="summary-number score-number smaller-summary-number">--</div>
@@ -106,10 +136,10 @@ class InteropSummary extends PolymerElement {
106136
<h3 class="summary-title">INVESTIGATIONS</h3>
107137
</div>
108138
</div>
109-
<div id="summaryNumberRow">
139+
<div class="summary-number-row" id="browserSummaryRow">
110140
<template is="dom-repeat" items="{{getYearProp('browserInfo')}}" as="browserInfo">
111141
<div class="summary-flex-item" tabindex="0">
112-
<div class="summary-number score-number smaller-summary-number">--</div>
142+
<div class="summary-number score-number browser-score smaller-summary-number">--</div>
113143
<template is="dom-if" if="{{isChromeEdgeCombo(browserInfo)}}">
114144
<!-- Chrome/Edge -->
115145
<template is="dom-if" if="[[stable]]">
@@ -158,7 +188,7 @@ class InteropSummary extends PolymerElement {
158188
</template>
159189
<template is="dom-if" if="{{isMobileScoresView}}">
160190
<div class="summary-flex-item" tabindex="0">
161-
<div class="summary-number score-number smaller-summary-number">--</div>
191+
<div class="summary-number score-number browser-score smaller-summary-number">--</div>
162192
<div class="summary-browser-name">
163193
<figure>
164194
<img src="/static/wktr_64x64.png" width="36" alt="Safari iOS" />
@@ -209,7 +239,9 @@ class InteropSummary extends PolymerElement {
209239
}
210240

211241
const summaryDiv = this.shadowRoot.querySelector('.summary-container');
212-
summaryDiv.style.minHeight = SUMMARY_CONTAINER_MIN_HEIGHTS[this.year] || '470px';
242+
if (window.innerWidth > 768) {
243+
summaryDiv.style.minHeight = SUMMARY_CONTAINER_MIN_HEIGHTS[this.year] || '470px';
244+
}
213245
// Don't display the interop score for Interop 2021.
214246
if (this.year === '2021') {
215247
const interopDiv = this.shadowRoot.querySelector('#interopSummary');

webapp/components/wpt-header.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,41 @@ class WPTHeader extends WPTFlags(PolymerElement) {
4747
header nav a {
4848
margin-right: 1em;
4949
}
50+
51+
/* Media Query for Mobile Devices */
52+
@media (max-width: 768px) {
53+
header {
54+
padding: 1em;
55+
}
56+
header h1 {
57+
font-size: 1em; /* Slightly adjusted for balance */
58+
}
59+
header > div {
60+
flex-direction: column; /* Stack logo/title and login button */
61+
align-items: flex-start; /* Align items to the left */
62+
gap: 1em; /* Add space between the stacked items */
63+
margin-bottom: 1em;
64+
}
65+
nav {
66+
display: flex;
67+
flex-direction: column; /* Stack nav links vertically */
68+
align-items: stretch; /* Stretch links to fill width */
69+
border-top: 1px solid #e0e0e0;
70+
padding-top: 0.5em;
71+
}
72+
nav a {
73+
margin-right: 0;
74+
padding: 0.25em;
75+
text-align: center;
76+
border-bottom: 1px solid #f0f0f0;
77+
}
78+
nav a:last-child {
79+
border-bottom: none;
80+
}
81+
img {
82+
vertical-align: middle;
83+
}
84+
}
5085
</style>
5186
<header>
5287
<div>

webapp/templates/interop.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<html lang="en">
33
<head>
44
{{ template "_head_common.html" . }}
5-
<!-- <meta name="color-scheme" content="dark light"> -->
6-
<script type="module" src="/components/interop.js"></script>
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<!-- <meta name="color-scheme" content="dark light"> -->
7+
<script type="module" src="/components/interop.js"></script>
78
</head>
89
<body>
910
<div id="content">

0 commit comments

Comments
 (0)