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

Added a drop down for multiple learn sections. Not styled. Need to de… #1073

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 43 additions & 29 deletions site/layouts/partials/learn-menu.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,58 @@
<aside class="learn-menu">
<!-- Dropdown Menu Added Here -->

<!-- Existing Sidebar Menu -->
<nav id="sideMenu" class="left-transform right-transform">

<div class="sidebar-dropdown">
<select onchange="if (this.value) window.location.href=this.value">
<option value="">Choose a topic</option>
<option value="/learn/playwright">Playwright</option>
<option value="/learn/monitoring">Monitoring</option>
<option value="/learn/tracing">Tracing</option>
</select>
</div>

<ul class="learn-menu-content">
{{ $currentPage := . }}
{{ range $index, $element:=.Site.Menus.learn }} {{ if .HasChildren }}
<li class='learn-menu-item'>
<div class='learn-menu-title{{ if $currentPage.HasMenuCurrent "learn" . }} active{{ end }}' id="{{$index}}">
<img src="{{.Pre}}" width="26" height="26" alt="{{.Name}}" />
{{.Name}}
</div>
<ul class='learn-menu-sub {{ if $currentPage.HasMenuCurrent "learn" . }}menu-display{{ end }}' id="learn-menu-{{$index}}">
{{range .Children}} {{ $has := $currentPage.IsMenuCurrent "learn" . }}
<li class="learn-menu-sub-item {{if $has}}active{{end}}">
<a href="{{.URL}}">
{{ partial "docs-title" . }}
</a>
{{ range $index, $element := .Site.Menus.learn }}
{{ if .HasChildren }}
<li class='learn-menu-item'>
<div class='learn-menu-title{{ if $currentPage.HasMenuCurrent "learn" . }} active{{ end }}' id="{{ $index }}">
<img src="{{ .Pre }}" width="26" height="26" alt="{{ .Name }}" />
{{ .Name }}
</div>
<ul class='learn-menu-sub {{ if $currentPage.HasMenuCurrent "learn" . }}menu-display{{ end }}' id="learn-menu-{{ $index }}">
{{ range .Children }}
{{ $has := $currentPage.IsMenuCurrent "learn" . }}
<li class="learn-menu-sub-item {{ if $has }}active{{ end }}">
<a href="{{ .URL }}">
{{ partial "docs-title" . }}
</a>
</li>
{{ end }}
</ul>
</li>
{{ else }}
<li class="learn-menu-item" id="learn-menu-{{ $index }}">
<div class="learn-menu-title">{{ .Name }}</div>
</li>
{{end}}
</ul>
</li>
{{else}}
<li class="learn-menu-item" id="learn-menu-{{$index}}">
<div class="learn-menu-title">{{.Name}}</div>
</li>
{{end}} {{end}}
{{ end }}
{{ end }}
</ul>
</nav>

<div class="learn-menu-mobile-right-space">
</div>

<!-- Restore menu position as soon as possible to avoid flickering -->
<script>
(function () {
var menu = document.querySelector('aside.learn-menu nav')
var menu = document.querySelector('aside.learn-menu nav');
addEventListener('beforeunload', function () {
localStorage.setItem('menu.scrollTop', menu.scrollTop)
})
menu.scrollTop = localStorage.getItem('menu.scrollTop')
})()
localStorage.setItem('menu.scrollTop', menu.scrollTop);
});
menu.scrollTop = localStorage.getItem('menu.scrollTop');
})();
</script>

</aside>


</aside>
35 changes: 35 additions & 0 deletions src/scss/_learn.scss
Original file line number Diff line number Diff line change
Expand Up @@ -622,4 +622,39 @@
padding: 5px 10px;
border-radius: 4px;
font-size: 14px;


}

.sidebar-dropdown {
margin-bottom: 20px;
background-color: #EDF0F3;
padding: 8px;
margin-left: -20px;
padding-left: 20px;
}

.sidebar-dropdown select {
width: 100%;
padding: 8px;
font-size: 16px;
border: 0px;
background: transparent;
color: #60758a;
}

.sidebar-dropdown select option {
padding: 10px;
font-size: 16px;
background-color: white; /* Background of dropdown items */
}

/* Dropdown on hover/focus */
.sidebar-dropdown select:focus {
outline: none;
border-color: #007bff; /* Blue border on focus */
}

.sidebar-dropdown select:hover {
border-color: #007bff; /* Change border on hover */
}
Loading