Skip to content

Commit 71e8b4e

Browse files
isaaccloosseanmonstar
authored andcommitted
chore(site): migrate to bootstrap 5 (#3216)
Browser support will change: https://getbootstrap.com/docs/5.0/migration/#browser-support. The style normalizing code is clumped together at the bottom of main.scss. This is to help future contributors adopted bootstrap 5 styles easily as the maintainers approve the differences.
1 parent a7105df commit 71e8b4e

7 files changed

Lines changed: 101 additions & 8 deletions

File tree

_includes/footer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<footer class="hyper-footer col-md-12">
22
<div class="container">
33
<div class="row">
4-
<div class="col-sm-6 text-center text-sm-left text-muted">&copy; 2023 hyper</div>
5-
<div class="col-sm-6 text-center text-sm-right">
4+
<div class="col-sm-6 text-center text-sm-start text-muted">&copy; 2023 hyper</div>
5+
<div class="col-sm-6 text-center text-sm-end">
66
{% if page.hyper_path %}
77
<a href="https://github.com/hyperium/hyper/blob/master/{{ page.hyper_path }}">
88
edit this page on github

_includes/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<title>{% if page.title %}{{ page.title }} | hyper{% else %}{{ site.title }}{% endif %}</title>
44
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
55

6-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
6+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha256-wLz3iY/cO4e6vKZ4zRmo4+9XDpMcgKOvv/zEU3OMlRo=" crossorigin="anonymous">
77
<link rel="stylesheet" href="{{ "/css/main.css" | absolute_url }}">
88

99
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

_includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<header class="navbar navbar-toggleable-md navbar-hyper" role="navigation">
1+
<header class="navbar navbar-expand-lg navbar-hyper" role="navigation">
22
<nav class="container">
33
<div class="collapse navbar-collapse">
44
<ul class="nav navbar-nav">

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</head>
66
<body id="hyper">
77
{% include header.html %}
8-
<div class="jumbotron">
8+
<div>
99
<div class="container">
1010
{{ content }}
1111
</div>

_layouts/guide.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1>{{ page.title }}</h1>
1212
</div>
1313
<div class="container">
1414
<div class="row">
15-
<aside class="col-md-3 hyper-sidebar">
15+
<aside class="col-lg-3 hyper-sidebar">
1616
<nav>
1717
{% if page.collection == "legacy" %}
1818
{% assign topics = site.data.legacy | first %}
@@ -41,7 +41,7 @@ <h4 class="guide-topic-title">
4141
</h4>
4242
</nav>
4343
</aside>
44-
<article class="col-md-9 hyper-content">
44+
<article class="col-lg-9 hyper-content">
4545
{{ content }}
4646
{% include guide_footer.html %}
4747
</article>

_layouts/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{% include header.html %}
88
<section class="hyper-pageheader">
99
<div class="container">
10-
<h1 class="hyper-logo">hyper</h1>
10+
<h1>hyper</h1>
1111
<p>Fast and safe HTTP for the Rust language.</p>
1212
<p><a href="/guides/1" class="btn hyper-getstarted">Get Started</a></p>
1313
</div>

css/main.scss

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,96 @@ pre code {
274274
background: none;
275275
color: $secondary-color;
276276
}
277+
278+
// Below are shims for a bootstrap 4 to 5 migration.
279+
// https://getbootstrap.com/docs/5.2/migration/
280+
//
281+
// Dropping these styles can incrementally shift the sites UI to a bootstrap 5 aesthetic.
282+
283+
// container
284+
.container {
285+
padding-left: 15px;
286+
padding-right: 15px;
287+
}
288+
289+
@media (min-width: 1400px) {
290+
.container {
291+
max-width: 1140px;
292+
}
293+
}
294+
295+
// btn
296+
.btn {
297+
border-radius: 0.25rem;
298+
line-height: 1.25;
299+
}
300+
301+
// headers
302+
h1 {
303+
font-size: 2.5rem;
304+
line-height: 1.1;
305+
}
306+
307+
h2, h3, h4, h5, h6 {
308+
font-size: 2rem;
309+
line-height: 1.1;
310+
}
311+
312+
article h3 {
313+
font-size: 1.75rem;
314+
line-height: 1.1;
315+
}
316+
317+
// a
318+
a {
319+
text-decoration: none;
320+
}
321+
322+
a.btn:hover {
323+
text-decoration: none;
324+
}
325+
326+
a:hover, a:focus {
327+
text-decoration: underline;
328+
}
329+
330+
// code
331+
code {
332+
font-size: 90%;
333+
border-radius: 0.25rem;
334+
}
335+
336+
// ul
337+
ul {
338+
padding-inline-start: 40px;
339+
}
340+
341+
// row
342+
.row {
343+
--bs-gutter-x: 30px;
344+
}
345+
346+
// code
347+
pre code {
348+
font-size: 12.96px;
349+
border-radius: 0;
350+
}
351+
352+
// navbar
353+
.navbar a {
354+
color: $primary-color;
355+
transition: none;
356+
}
357+
358+
.navbar a:hover, .navbar a:focus {
359+
color: $primary-highlight-color;
360+
text-decoration: none;
361+
}
362+
363+
.navbar .navbar-brand {
364+
color: $primary-color
365+
}
366+
367+
.navbar .navbar-brand:hover {
368+
color: $primary-highlight-color
369+
}

0 commit comments

Comments
 (0)