Introduce mobile responsiveness (#194)

This commit is contained in:
Arseniy authored and GitHub committed 2024-03-07 18:19:20 -05:00
1 parent 989305997b
commit b768f9f5c3
3 files changed
+122 -21

No files matched your search

+106 -20
View File
@@ -33,6 +33,10 @@ body, html, main{
flex-basis: calc(min(300px, max(200px, 10%))); flex-basis: calc(min(300px, max(200px, 10%)));
} }
#sidebar-toggle {
display: none;
}
#content-parent{ #content-parent{
flex-grow: 1; flex-grow: 1;
justify-content: left; justify-content: left;
@@ -50,26 +54,6 @@ body, html, main{
display: inline-block; display: inline-block;
} }
/* Styles for screen widths less than 600px */
@media (max-width: 599px) {
#sidebar {
flex-basis: 100%;
padding: 16px;
}
#content-parent {
height: auto;
flex-grow: 0;
flex-basis: 100%;
}
body {
flex-direction: column;
}
}
#sidebar ul { #sidebar ul {
list-style-type: none; list-style-type: none;
padding: 0px 16px 0px 8px; padding: 0px 16px 0px 8px;
@@ -399,3 +383,105 @@ td pre {
#content .active-highlight { #content .active-highlight {
border-left: 4px solid var(--color-font3); border-left: 4px solid var(--color-font3);
} }
/* Styles for screen widths less than 768px */
@media (max-width: 767px) {
#sidebar {
flex-basis: 100%;
position: fixed;
top: 0;
bottom: 0;
width: 100%;
background-color: var(--color1);
overflow-y: auto;
transition: transform cubic-bezier(0.82, 0.08, 0.1, 0.93) 0.3s;
transform: translateX(-100%);
}
body.sidebar-open #sidebar {
transform: none;
}
#sidebar-toggle {
display: flex;
padding: 10px;
color: var(--color-font1);
background-color: transparent;
border: none;
position: relative;
z-index: 10;
font-size: 2.2rem;
}
#content-parent {
height: auto;
flex-grow: 0;
flex-basis: 100%;
padding: 0 8px;
}
#content {
overflow-x: hidden;
margin-top: 70px;
}
#content-header {
display: flex;
align-items: center;
background-color: var(--color1);
position: absolute;
top: 0;
left: 0;
z-index: 10;
}
#content-header h2 {
font-size: 1.4rem;
margin: 8px 0;
}
#content-header .site-title {
white-space: break-spaces;
}
body {
flex-direction: column;
}
/* Disable vertical body scrolling when the sidebar is open */
body.sidebar-open {
position: fixed;
overflow-y: hidden;
}
/* Horizontally scrollable table */
table {
display: block;
overflow-x: auto;
}
/* Tables cannot break words to avoid issues such as single-letter lines */
/* The only exception is the test config table */
#content .wrappable:not(.workload-container .test-config) td {
word-break: normal;
}
/* Test Views */
.workload-container {
display: flex;
flex-direction: column;
}
#content #actions {
order: -1;
margin: 0 0 1rem 0;
}
#content #config {
float: none;
}
#content .long-statblock {
overflow-x: auto;
}
}
+12 -1
View File
@@ -5,6 +5,8 @@
{% load static %} {% load static %}
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/svg+xml" href="{% static 'logo.svg' %}"> <link rel="icon" type="image/svg+xml" href="{% static 'logo.svg' %}">
<link rel="stylesheet" href="{% static 'style.css' %}"> <link rel="stylesheet" href="{% static 'style.css' %}">
<link rel="stylesheet" href="{% static 'base.css' %}"> <link rel="stylesheet" href="{% static 'base.css' %}">
@@ -54,6 +56,10 @@
} }
}, false); }, false);
function toggleSidebar() {
document.body.classList.toggle('sidebar-open')
}
</script> </script>
</head> </head>
@@ -124,9 +130,14 @@
<div id="content-parent"> <div id="content-parent">
<div id="content" class="pb-5"> <div id="content" class="pb-5">
<div id="content-header">
<button id="sidebar-toggle" onclick="toggleSidebar()">
<i class="fa-solid fa-bars fa-fw"></i>
</button>
<h2> <h2>
<a class="site-title" href="/">OpenBench Testing Framework</a> <a class="site-title" href="/">OpenBench Testing&nbsp;Framework</a>
</h2> </h2>
</div>
{% if request.session.error_message %} {% if request.session.error_message %}
<div class="error-message"> <div class="error-message">
+4
View File
@@ -9,6 +9,8 @@
{% block content %} {% block content %}
<div class="workload-container">
<div id="config" style="display: block; overflow-x: auto;"> <div id="config" style="display: block; overflow-x: auto;">
<table class="test-config left-align wrappable" style="table-layout: auto; width: 100%;"> <table class="test-config left-align wrappable" style="table-layout: auto; width: 100%;">
@@ -233,4 +235,6 @@
</table> </table>
</div> </div>
</div>
{% endblock %} {% endblock %}