Skip to content

Commit 9438ebb

Browse files
committed
tweak css sidebar to be responsive
1 parent b810383 commit 9438ebb

File tree

3 files changed

+48
-8
lines changed

3 files changed

+48
-8
lines changed

docs/_includes/sidebar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<aside class="col-lg-3 pl-4 pt-1 pb-1 bg-gray">
1+
<aside class="sidebar position-md-sticky px-4 col-lg-3 py-4 py-md-1 mb-4 mb-md-0 pb-1 bg-gray">
22
<label class="d-flex mr-4 flex-items-center">
33
<span class="mr-4">Version</span>
44
<select class="flex-1" onchange="window.location.href = this.value">
@@ -8,7 +8,7 @@
88
</label>
99
<br>
1010

11-
<nav class="position-sticky top-100px">
11+
<nav>
1212
<ol class="f3-light ml-4">
1313
{% for item in sidebarItems %}
1414
<li class="py-1">

docs/_layouts/default.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
<link rel="apple-touch-icon" sizes="512x512" href="{{ site.baseurl }}/icons/icon-512x512.png?">
2222
<link rel="icon" href="{{ site.baseurl }}/icons/icon-48x48.png">
2323
</head>
24-
<body class="d-flex flex-column height-full">
25-
<header class="position-sticky top-0 d-md-flex"
26-
style="z-index: 1; background-image: linear-gradient(to top, var(--color-bg-canvas-shadow), var(--color-bg-canvas) 25%)">
27-
<div class="flex-1 pl-3 pb-6 col-md-3 {% if page.layout != "default" %}bg-gray{% endif %}">
24+
<body class="d-flex flex-column min-height-full">
25+
<header class="d-flex position-md-sticky top-0 d-md-flex main-header">
26+
<div class="logo flex-1 pl-3 pb-6 col-md-3 {% if page.layout != "default" %}bg-gray{% endif %}">
2827
<h1 class="m-0 mt-md-2">Catalyst</h1>
2928
</div>
30-
<nav class="f3 col-md-9 d-flex flex-justify-center flex-md-justify-end">
29+
<nav class="f3 mr-4 mr-md-0 col-md-9 d-flex flex-justify-center flex-md-justify-end">
3130
<ul class="d-flex list-style-none mr-md-6">
3231
<li class="ml-3 mt-3 mb-3">
3332
<a href="{{ site.baseurl }}/">

docs/custom.css

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,47 @@ a {
6060
color: var(--color-accent-fg);
6161
}
6262

63+
.min-height-full {
64+
min-height: 100vh
65+
}
66+
67+
.main-header {
68+
height: 5rem;
69+
z-index: 1;
70+
background-image: linear-gradient(to top, var(--color-bg-canvas-shadow), var(--color-bg-canvas) 25%);
71+
}
72+
73+
:root {
74+
--logo-width: 18rem;
75+
}
76+
77+
.logo {
78+
min-width: var(--logo-width);
79+
}
80+
81+
.sidebar {
82+
height: calc(100vh - 5rem);
83+
top: 5rem;
84+
min-width: var(--logo-width);
85+
}
86+
87+
@media only screen and (max-device-width : 768px) {
88+
.main-header {
89+
height: auto;
90+
background: none;
91+
}
92+
93+
.sidebar {
94+
height: auto;
95+
}
96+
97+
.logo.bg-gray {
98+
background-color: inherit !important;
99+
min-width: 9rem;
100+
}
101+
}
102+
103+
63104
/* Sidebar */
64105
/* NB: `!important` is already used; so it’s required here */
65106
.bg-gray {
@@ -116,4 +157,4 @@ a {
116157
padding: 16px;
117158
border-radius: 4px;
118159
flex: 1;
119-
}
160+
}

0 commit comments

Comments
 (0)