Skip to content

Commit 94ea102

Browse files
committed
[PHP API Reference] Fixed navigation on mobile view (#3298)
1 parent 7cb71c6 commit 94ea102

6 files changed

Lines changed: 72 additions & 6 deletions

File tree

tools/php_api_ref/.phpdoc/template/components/header.html.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<header class="md-header" data-md-component="header">
22
<nav class="md-header__inner md-grid" aria-label="">
3+
<label class="md-header__button md-icon" for="__drawer" aria-label="Open navigation">
4+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
5+
</label>
36
{% include 'components/header-title.html.twig' %}
47
{% include 'components/doc-switcher.html.twig' %}
58
{% include 'components/version-switcher.html.twig' %}

tools/php_api_ref/.phpdoc/template/css/base.css.twig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ body.menu-resizing {
3131
background-color: #306CBE;
3232
}
3333

34-
.main_nav_content,
35-
.md-sidebar--primary {
36-
width: 100%;
34+
@media only screen and (min-width: 76.1875em) {
35+
.main_nav_content,
36+
.md-sidebar--primary {
37+
width: 100%;
38+
}
3739
}
3840

3941
.md-sidebar--primary {

tools/php_api_ref/.phpdoc/template/css/docs.switcher.css.twig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,9 @@
122122
.md-header__switcher .rst-other-versions dt {
123123
display: none;
124124
}
125+
126+
@media only screen and (max-width: 44.9375em) {
127+
.md-header__switcher:not(.push) {
128+
display: none;
129+
}
130+
}

tools/php_api_ref/.phpdoc/template/css/navigation.css.twig

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,69 @@
11
.main_nav {
22
border-right: 1px solid var(--mid-grey);
3-
margin-left: -15rem;
43
display: flex;
54
flex-shrink: 0;
65
}
76

7+
@media only screen and (max-width: 76.1874em) {
8+
.main_nav {
9+
width: 0 !important;
10+
border-right: none;
11+
}
12+
13+
.main_nav .site-header,
14+
.main_nav__resize-handler {
15+
display: none;
16+
}
17+
18+
.md-sidebar--primary .md-sidebar__scrollwrap {
19+
overflow-y: auto;
20+
}
21+
22+
/* Keep the desktop-style nav tree inside the drawer instead of
23+
Material's layered sliding panels */
24+
.md-nav--primary,
25+
.md-nav--primary .md-nav {
26+
position: static;
27+
display: block;
28+
height: auto;
29+
z-index: auto;
30+
}
31+
32+
.md-nav--primary .md-nav__item {
33+
border-top: none;
34+
}
35+
36+
.md-nav__toggle ~ .md-nav {
37+
display: none;
38+
opacity: 1;
39+
transform: none;
40+
transition: none;
41+
}
42+
43+
.md-nav__toggle:checked ~ .md-nav,
44+
.md-nav__toggle:indeterminate ~ .md-nav {
45+
display: block;
46+
}
47+
48+
.md-typeset h1,
49+
.md-typeset h2,
50+
.md-typeset h3,
51+
.md-typeset h4 {
52+
overflow-wrap: anywhere;
53+
}
54+
55+
.md-typeset .method-parameters {
56+
display: block;
57+
overflow-x: auto;
58+
}
59+
}
60+
861
.md-sidebar__scrollwrap {
962
margin: 0;
1063
}
1164

1265
@media only screen and (min-width: 76.1875em) {
1366
.main_nav {
14-
margin-left: 0;
1567
position: sticky;
1668
top: 56px;
1769
height: calc(100vh - 56px);

tools/php_api_ref/.phpdoc/template/js/menu-resizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
const setWidthOfSecondLevelMenu = () => {
2626
let secondLevelMenuWidth = getCookie('php-api:menu-width');
2727

28-
if (!secondLevelMenuWidth) {
28+
if (!secondLevelMenuWidth || window.matchMedia('(max-width: 76.1875em)').matches) {
2929
return;
3030
}
3131

tools/php_api_ref/.phpdoc/template/layout.html.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
<div class="popover popover--copied">Copied!</div>
2626

2727
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
28+
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
2829

2930
{% include 'components/header.html.twig' %}
3031

32+
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
33+
3134
<div class="md-container" data-md-component="container">
3235
<main class="md-main" data-md-component="main">
3336
<div class="md-main__inner md-grid">

0 commit comments

Comments
 (0)