Skip to content

Commit

Permalink
馃摉: Add version dropdown for doc release (#3332)
Browse files Browse the repository at this point in the history
add version dropdown for doc
  • Loading branch information
pratikmota committed Apr 14, 2023
1 parent c3d5cf7 commit b17a13e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title = "The Kubebuilder Book"
[output.html]
google-analytics = "UA-119864590-1"
curly-quotes = true
additional-css = ["theme/css/markers.css", "theme/css/custom.css"]
additional-css = ["theme/css/markers.css", "theme/css/custom.css", "theme/css/version-dropdown.css"]
git-repository-url = "https://github.com/kubernetes-sigs/kubebuilder"
edit-url-template = "https://github.com/kubernetes-sigs/kubebuilder/edit/master/docs/book/{path}"

Expand Down
23 changes: 23 additions & 0 deletions docs/book/theme/css/version-dropdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.version-dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 90px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}

.version-dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

.version-dropdown-content a:hover {
background-color: #f1f1f1;
}

.version-dropdown:hover .version-dropdown-content {
display: block;
}
11 changes: 11 additions & 0 deletions docs/book/theme/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@
<i class="fa fa-search"></i>
</button>
{{/if}}
<!-- custom code for adding release version dropdown menu -->
<div class="version-dropdown">
<button id="release-version" class="icon-button" type="button" title="Release version" aria-label="Release version" aria-haspopup="true" aria-expanded="false" aria-controls="release-versions">
<i class="fa fa-book"></i>
</button>
<div class="version-dropdown-content">
<a href="https://book.kubebuilder.io/"target="_blank" rel="noopener noreferrer">v3-book</a>
<a href="https://book-v2.book.kubebuilder.io/"target="_blank" rel="noopener noreferrer">v2-book</a>
<a href="https://book-v1.book.kubebuilder.io/"target="_blank" rel="noopener noreferrer">v1-book</a>
</div>
</div>
</div>

<h1 class="menu-title"><img alt="{{ book_title }}" src="{{ path_to_root }}/logos/logo-single-line.png"></h1>
Expand Down

0 comments on commit b17a13e

Please sign in to comment.