Skip to content

Commit 95798d0

Browse files
authored
Merge pull request #1498 from scylladb/docs-fix-mobile-announcement-bar
2 parents f20054d + 178166d commit 95798d0

File tree

10 files changed

+92
-40
lines changed

10 files changed

+92
-40
lines changed

sphinx_scylladb_theme/promo-banner.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<section class="promo-banner {{'promo-banner--hide' if not theme_hide_banner}} {{'promo-banner--hide' if theme_hide_banner|lower == 'true'}}" style="display: none;">
22
<div class="promo-banner-wrapper">
3-
{% if theme_banner_icon_path %}
4-
<div class="promo-banner__icon">
5-
<img src="{{ pathto(theme_banner_icon_path, 1) }}" />
6-
</div>
7-
{% endif %}
8-
<div class="promo-banner__title">{{theme_banner_title_text}}</div>
9-
<a class="promo-banner__button button button--reverse" href="{{theme_banner_button_url}}"
10-
target="_blank" rel="noopener noreferrer">{{theme_banner_button_text}}</a>
3+
<div class="promo-banner__content">
4+
{% if theme_banner_icon_path %}
5+
<div class="promo-banner__icon">
6+
<img src="{{ pathto(theme_banner_icon_path, 1) }}" />
7+
</div>
8+
{% endif %}
9+
<div class="promo-banner__title">{{theme_banner_title_text}}</div>
10+
<a class="promo-banner__button button button--reverse" href="{{theme_banner_button_url}}"
11+
target="_blank" rel="noopener noreferrer">{{theme_banner_button_text}}</a>
12+
</div>
1113
<button class="promo-banner__close">
1214
<i class="icon-cancel"></i>
1315
</button>

sphinx_scylladb_theme/static/css/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sphinx_scylladb_theme/static/js/main.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/css/base/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ $product-title-height: $spacer-md;
225225
--biel-primary-color: #{$primary};
226226
--biel-button-dark-bg-color: #{$primary};
227227
--biel-input-button-bg-color: #{$primary};
228+
--biel-bot-content-z-index: 900;
228229
}
229230

230231
@each $key, $styles in $brand-colors {

src/css/components/_content.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
padding-left: $spacer;
1717
padding-right: $spacer;
1818
}
19-
19+
2020
@media screen and (min-width: $xlarge) {
2121
padding-left: $spacer-md;
2222
padding-right: $spacer-md;
@@ -31,7 +31,7 @@
3131
padding-top: $spacer;
3232
padding-bottom: $spacer;
3333
}
34-
34+
3535
@media screen and (min-width: $xlarge) {
3636
padding-top: $spacer-md;
3737
padding-bottom: $spacer-md;
@@ -57,7 +57,6 @@
5757
}
5858
}
5959

60-
6160

6261
.post-content {
6362
padding-bottom: $spacer-md;

src/css/components/_header.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
align-items: center;
33
background-color: var(--card-bg);
44
box-shadow: 0 2px 22px rgba(0,0,0, 0.1);
5-
display: flex;
5+
display: flex;
66
flex-wrap: wrap;
77
gap: $spacer-xs 0;
88
justify-content: space-between;
9-
position: sticky;
9+
position: fixed;
1010
top: 0;
1111
padding: $spacer-xs $spacer-sm;
1212
width: 100%;
1313
z-index: 99;
1414

1515
@media screen and (min-width: $large) {
16+
position: sticky;
1617
min-height: $header-height-large;
1718
padding: $spacer-xs $spacer;
1819
}
@@ -164,7 +165,7 @@
164165
width: auto;
165166
min-width: 300px;
166167
gap: 20px;
167-
168+
168169
.header-ask-ai {
169170
display: block;
170171
}

src/css/components/_promo-banner.scss

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
}
3636

3737
&__close {
38-
display: none;
39-
position: absolute;
40-
right: 16px;
41-
top: 16px;
38+
background: none;
39+
border: none;
40+
padding: 0;
41+
margin-left: 16px;
4242

4343
i {
44-
height: 34px;
45-
width: 34px;
46-
font-size: 34px;
44+
height: 20px;
45+
width: 20px;
46+
font-size: 20px;
4747
color: var(--white);
4848
}
4949

@@ -57,10 +57,17 @@
5757
.promo-banner-wrapper {
5858
align-items: center;
5959
display: flex;
60-
justify-content: center;
60+
justify-content: space-between;
6161
padding: 5.85px 20px;
6262
}
6363

64+
.promo-banner__content {
65+
align-items: center;
66+
display: flex;
67+
justify-content: center;
68+
flex: 1;
69+
}
70+
6471
@media (min-width: $large) {
6572
.promo-banner {
6673
&__title {
@@ -72,8 +79,15 @@
7279
font-size: $font-sm;
7380
padding: 8.5px;
7481
}
82+
7583
&__close {
76-
display: block;
84+
margin: 0;
85+
86+
i {
87+
height: 34px;
88+
width: 34px;
89+
font-size: 34px;
90+
}
7791
}
7892
}
7993
.promo-banner-wrapper {

src/css/components/_side-nav-toggle.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
gap: 10px;
55
font-size: 22px;
66
position: relative;
7-
z-index: 300;
7+
z-index: 1000;
88
}
99

1010
@media screen and (min-width: $large) {

src/css/components/_side-nav.scss

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@
1818
top: $header-height;
1919
left: 0;
2020
width: 100%;
21-
z-index: 100;
21+
z-index: 950;
22+
23+
&.show {
24+
display: flex;
25+
flex-direction: column;
26+
}
2227

2328
@media screen and (min-width: $large) {
29+
display: flex;
30+
flex-direction: column;
2431
position: sticky;
2532
flex-grow: 1;
2633
}
@@ -43,7 +50,7 @@
4350

4451
&:hover {
4552
filter: brightness(105%);
46-
53+
4754
}
4855
}
4956
}
@@ -60,10 +67,10 @@
6067
}
6168

6269
.toctree-l1 {
63-
70+
6471
&:not(.has-children) {
6572
display: flex;
66-
73+
6774
&::before {
6875
content: '';
6976
width: $spacer;
@@ -72,8 +79,8 @@
7279
opacity: .4;
7380
}
7481
}
75-
76-
a {
82+
83+
a {
7784
font-size: 16px;
7885
font-weight: 500;
7986
}
@@ -89,7 +96,7 @@
8996
width: $spacer-sm;
9097
height: $spacer-sm;
9198
font-size: 14px;
92-
99+
93100
}
94101

95102
ul {
@@ -128,7 +135,7 @@
128135
order: 3;
129136
}
130137

131-
138+
132139
}
133140

134141
/* Override icons extension */
@@ -214,7 +221,7 @@
214221
li {
215222
list-style: none;
216223
padding: 0;
217-
224+
218225

219226
&.has-children {
220227
display: flex;
@@ -349,7 +356,7 @@
349356
@media screen and (min-width: $xlarge) {
350357
.side-nav {
351358
width: $side-nav-width;
352-
359+
353360
.side-nav-content {
354361
height: 0;
355362
flex-grow: 1;

src/js/sidebar.js

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ export class SidebarHandler {
33
constructor() {
44
this.localStorageKey = "scylladb-docs-sidebar-scroll-position";
55
}
6-
6+
77
initScrollEvent() {
88
const sideNavContent = $('#side-nav .side-nav-content');
99
sideNavContent.on('scroll', () => {
1010
const scrollPosition = sideNavContent.scrollTop();
1111
localStorage.setItem(this.localStorageKey, scrollPosition);
12-
console.log('scrollPosition', scrollPosition);
1312
});
1413
}
1514

@@ -19,12 +18,41 @@ export class SidebarHandler {
1918
if (savedPosition) {
2019
sideNavContent.scrollTop(savedPosition);
2120
}
22-
// $('.side-nav-content').css('visibility', 'visible');
2321
}
2422

25-
23+
initHamburgerToggle() {
24+
const hamburger = $('.side-nav-toggle__button');
25+
const sideNav = $('#side-nav');
26+
27+
hamburger.on('click', function(e) {
28+
e.preventDefault();
29+
e.stopPropagation();
30+
sideNav.toggleClass('show');
31+
});
32+
}
33+
34+
handleResize() {
35+
const sideNav = $('#side-nav');
36+
const mediaQuery = window.matchMedia('(min-width: 1024px)');
37+
38+
const checkResize = (e) => {
39+
if (e.matches) {
40+
// Desktop view - remove the show class
41+
sideNav.removeClass('show');
42+
}
43+
};
44+
45+
// Check on load
46+
checkResize(mediaQuery);
47+
48+
// Listen for changes
49+
mediaQuery.addListener(checkResize);
50+
}
51+
2652
init() {
2753
this.initScrollEvent();
2854
this.onLoadRestoreScrollPosition();
55+
this.initHamburgerToggle();
56+
this.handleResize();
2957
}
3058
}

0 commit comments

Comments
 (0)