Skip to content

Commit bfb8758

Browse files
Fix layout responsiveness
1 parent 04b574f commit bfb8758

File tree

6 files changed

+61
-99
lines changed

6 files changed

+61
-99
lines changed

articles/introduction/article.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ title: "Introduction"
22
content: "article.md"
33
author: "multitheftauto"
44
date: "January 1, 2025"
5-
revisions: []
65
assets: []

articles/official-guides/getting-started/article.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ title: "Getting Started"
22
content: "article.md"
33
author: "multitheftauto"
44
date: "January 1, 2025"
5-
revisions: []
5+
: []
66
assets: []

articles/privacy/article.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ title: "Privacy policy"
22
content: "article.md"
33
author: "multitheftauto"
44
date: "January 1, 2025"
5-
revisions: []
65
assets: []

schemas/article.yaml

-20
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ required:
77
- content
88
- author
99
- date
10-
- revisions
1110
- assets
1211
properties:
1312
title:
@@ -22,25 +21,6 @@ properties:
2221
date:
2322
type: "string"
2423
description: "The date the article was published."
25-
revisions:
26-
type: "array"
27-
description: "A list of revisions made to the article."
28-
items:
29-
type: "object"
30-
required:
31-
- date
32-
- author
33-
- changes
34-
properties:
35-
date:
36-
type: "string"
37-
description: "The date the revision was made."
38-
author:
39-
type: "string"
40-
description: "The author of the revision."
41-
changes:
42-
type: "string"
43-
description: "A brief description of the changes made."
4424
assets:
4525
type: "array"
4626
description: "A list of assets used in the article."

web/resources/assets/style.css

+49-61
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ hr {
119119
float: right;
120120
font-size: 1.8em;
121121
padding-top: 2px;
122-
position: relative;
123-
z-index: 1;
124122
}
125123

126124

@@ -150,7 +148,7 @@ header {
150148
opacity: 0.8;
151149
}
152150
#logo-wrapper {
153-
height: 64px;
151+
height: 52px;
154152
position: relative;
155153
padding: 16px;
156154
margin: 0 auto;
@@ -168,89 +166,79 @@ header {
168166
}
169167

170168

171-
/* Grid container */
172-
.grid-container {
173-
display: grid;
174-
grid-template-columns: 1fr 6fr;
175-
grid-template-rows: auto;
176-
max-width: 100%; /* Prevents the grid container from exceeding the page width */
177-
overflow-x: hidden; /* Prevents horizontal scrolling */
178-
box-sizing: border-box; /* Ensures padding is included in width calculations */
169+
.container {
170+
display: flex;
179171
}
180172

181-
/* Main content styles */
182-
#main-content {
183-
padding: 20px;
184-
max-width: 100%; /* Limits the width of the inner divs */
185-
box-sizing: border-box;
173+
.sidebar {
174+
padding: 1em;
175+
border-right: 1px solid #394a60;
176+
display: block;
177+
width: 150px;
186178
}
187-
188-
189-
/* Sidebar styles */
190-
191-
192-
/* Ensure #menu-toggle is hidden on larger screens */
193-
#menu-toggle {
179+
.toggle-sidebar {
194180
display: none;
181+
background-color: #333;
182+
border: none;
183+
border-radius: 5px;
184+
color: white;
185+
padding: 0.5em;
186+
cursor: pointer;
187+
font-size: 1.6em;
188+
margin-left: auto;
189+
position: absolute;
190+
bottom: 20px;
191+
right: 20px;
192+
z-index: 1000;
193+
}
194+
195+
.content {
196+
flex: 1;
197+
padding: 1rem;
195198
}
196199

197-
/* Hide sidebar on smaller screens */
198-
@media (max-width: 768px) {
199-
.grid-container {
200-
display: grid;
201-
grid-template-columns: 1fr;
202-
grid-template-rows: auto;
203-
max-width: 100%; /* Prevents the grid container from exceeding the page width */
204-
overflow-x: hidden; /* Prevents horizontal scrolling */
205-
box-sizing: border-box; /* Ensures padding is included in width calculations */
200+
/* Media query for smaller screens */
201+
@media (max-width: 900px) {
202+
.container {
203+
flex-direction: column;
204+
}
205+
206+
.sidebar {
207+
display: none;
208+
background-color: #333;
209+
border: none;
210+
border: 2px solid #394a60;
211+
position: absolute;
212+
right: 0;
206213
}
207214

208-
.sidebar-left {
209-
display: none;
210-
position: fixed;
211-
left: 0;
212-
width: 100%;
213-
background: #151b23;
214-
overflow-y: auto;
215-
z-index: 1000;
215+
.sidebar.active {
216+
display: block;
216217
}
217218

218-
.sidebar-left.open {
219-
display: block;
219+
.content {
220+
padding: 1rem;
220221
}
221222

222-
#menu-toggle {
223-
display: inline-block;
224-
background: none;
225-
border: none;
226-
font-size: 1.5rem;
227-
color: white;
228-
cursor: pointer;
229-
margin-left: auto;
230-
position: absolute;
231-
bottom: 20px;
232-
right: 20px;
223+
.toggle-sidebar {
224+
display: block;
233225
}
234226
}
235227

236-
.sidebar-left {
237-
padding: 20px;
238-
border-right: 1px solid #394a60;
239-
}
240-
.sidebar-left ul {
228+
.sidebar ul {
241229
list-style: none;
242230
padding: 0;
243231
margin: 0;
244232
}
245-
.sidebar-left ul li {
233+
.sidebar ul li {
246234
margin: 5px 0;
247235
}
248-
.sidebar-left ul li a {
236+
.sidebar ul li a {
249237
padding-top: 10px;
250238
padding-left: 10px;
251239
padding-bottom: 10px;
252240
}
253-
.sidebar-left ul li p {
241+
.sidebar ul li p {
254242
padding-top: 10px;
255243
padding-left: 10px;
256244
padding-bottom: 0;

web/resources/layout.html

+11-15
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
2626

2727
<!-- Custom CSS -->
28-
<link rel="stylesheet" href="/assets/style.css?v=1.6">
28+
<link rel="stylesheet" href="/assets/style.css?v=1.7">
2929
</head>
3030
<body>
3131
<nav id="mta-global-navbar">
@@ -68,15 +68,15 @@
6868
{% if preview_mode %}
6969
<div class="preview-badge">Preview</div>
7070
{% endif %}
71-
<!-- Add a menu button for mobile -->
72-
<button id="menu-toggle" aria-label="Toggle navigation">
71+
72+
<button class="toggle-sidebar" aria-label="Toggle navigation">
7373
<i class="fa-solid fa-bars"></i>
7474
</button>
7575
</div>
7676
</header>
7777

78-
<div class="grid-container">
79-
<nav class="sidebar-left" id="sidebar">
78+
<div class="container">
79+
<aside class="sidebar">
8080
<ul>
8181
{% for item in navigation %}
8282
{% if item.path_html %}
@@ -91,10 +91,10 @@
9191
{% endif %}
9292
{% endfor %}
9393
</ul>
94-
</nav>
95-
<div id="main-content">
94+
</aside>
95+
<main class="content">
9696
{{ content }}
97-
</div>
97+
</main>
9898
</div>
9999

100100
<footer>
@@ -106,13 +106,9 @@
106106
</footer>
107107

108108
<script>
109-
document.addEventListener('DOMContentLoaded', () => {
110-
const menuToggle = document.getElementById('menu-toggle');
111-
const sidebar = document.getElementById('sidebar');
112-
113-
menuToggle.addEventListener('click', () => {
114-
sidebar.classList.toggle('open');
115-
});
109+
document.querySelector('.toggle-sidebar').addEventListener('click', () => {
110+
const sidebar = document.querySelector('.sidebar');
111+
sidebar.classList.toggle('active');
116112
});
117113

118114
var copyTexts = {};

0 commit comments

Comments
 (0)