Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example dashboard: fix menu disappearing on small viewport #30272

Merged
merged 2 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 11 additions & 14 deletions site/content/docs/4.3/examples/dashboard/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ body {
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

@media (max-width: 767.98px) {
.sidebar {
top: 5rem;
}
}

.sidebar-sticky {
position: relative;
top: 0;
Expand Down Expand Up @@ -62,20 +68,6 @@ body {
text-transform: uppercase;
}

/*
* Content
*/

[role="main"] {
padding-top: 133px; /* Space for fixed navbar */
}

@media (min-width: 768px) {
[role="main"] {
padding-top: 48px; /* Space for fixed navbar */
}
}

/*
* Navbar
*/
Expand All @@ -88,6 +80,11 @@ body {
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}

.navbar .navbar-toggler {
top: .25rem;
right: 1rem;
}

.navbar .form-control {
padding: .75rem 1rem;
border-width: 0;
Expand Down
11 changes: 7 additions & 4 deletions site/content/docs/4.3/examples/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
- src: "dashboard.js"
---

<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="#">Company name</a>
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-2 mr-0" href="#">Company name</a>
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-toggle="collapse" data-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
Expand All @@ -23,7 +26,7 @@

<div class="container-fluid">
<div class="row">
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<nav id="sidebarMenu" class="col-md-2 d-md-block bg-light sidebar collapse">
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
Expand Down Expand Up @@ -99,7 +102,7 @@ <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-
</div>
</nav>

<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Dashboard</h1>
<div class="btn-toolbar mb-2 mb-md-0">
Expand Down