Skip to content

Commit

Permalink
[FSTORE-1346] Fix theme, latest redirect, dropdown and custom css (#372)
Browse files Browse the repository at this point in the history
* Minimal changes

* Add support for latest redirect
  • Loading branch information
vatj authored Apr 11, 2024
1 parent a2b04ae commit 4abef46
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
7 changes: 5 additions & 2 deletions docs/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:root {
[data-md-color-scheme="hopsworks"] {
--md-primary-fg-color: #1eb382;
--md-secondary-fg-color: #188a64;
--md-tertiary-fg-color: #0d493550;
Expand All @@ -9,7 +9,6 @@
.md-footer__inner:not([hidden]) {
display: none;
}

/* Lex did stuff here */
.svg_topnav {
width: 12px;
Expand All @@ -24,6 +23,10 @@
box-shadow: 0 0 0 0;
}

.md-tabs__item {
min-width: 2.5rem;
}

.md-tabs__item:hover {
background-color: var(--md-tertiary-fg-color);
transition: background-color 450ms;
Expand Down
2 changes: 1 addition & 1 deletion docs/css/dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ overflow: inherit;

/* The container <div> - needed to position the dropdown content */
.dropdown {
position: relative;
position: absolute;
display: inline-block;
}

Expand Down
16 changes: 11 additions & 5 deletions docs/js/inject-api-links.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
window.addEventListener("DOMContentLoaded", function () {
var windowPathNameSplits = window.location.pathname.split("/");
var majorVersionRegex = new RegExp("(\\d+[.]\\d+)")
var latestRegex = new RegExp("latest")
if (majorVersionRegex.test(windowPathNameSplits[1])) { // On landing page docs.hopsworks.api/3.0 - URL contains major version
// Version API dropdown
document.getElementById("hopsworks_api_link").href = "https://docs.hopsworks.ai/hopsworks-api/" + windowPathNameSplits[1] + "/generated/api/login/";
document.getElementById("hsfs_api_link").href = "https://docs.hopsworks.ai/feature-store-api/" + windowPathNameSplits[1] + "/generated/api/connection_api/";
document.getElementById("hsml_api_link").href = "https://docs.hopsworks.ai/machine-learning-api/" + windowPathNameSplits[1] + "/generated/connection_api/";
document.getElementById("hsfs_javadoc_link").href = "https://docs.hopsworks.ai/feature-store-api/" + windowPathNameSplits[1] + "/javadoc";
document.getElementById("hsml_api_link").href = "https://docs.hopsworks.ai/machine-learning-api/" + windowPathNameSplits[1] + "/generated/connection_api/";
} else { // on docs.hopsworks.api/feature-store-api/3.0 / docs.hopsworks.api/hopsworks-api/3.0 / docs.hopsworks.api/machine-learning-api/3.0
var apiVersion = windowPathNameSplits[2];
var majorVersion = apiVersion.match(majorVersionRegex)[0];

if (latestRegex.test(windowPathNameSplits[2]) || latestRegex.test(windowPathNameSplits[1])) {
var majorVersion = "latest";
} else {
var apiVersion = windowPathNameSplits[2];
var majorVersion = apiVersion.match(majorVersionRegex)[0];
}
// Version main navigation
document.getElementsByClassName("md-tabs__link")[0].href = "https://docs.hopsworks.ai/" + majorVersion;
document.getElementsByClassName("md-tabs__link")[1].href = "https://docs.hopsworks.ai/" + majorVersion + "/getting_started/quickstart/";
document.getElementsByClassName("md-tabs__link")[2].href = "https://docs.hopsworks.ai/" + majorVersion + "/tutorials/fraud_batch/1_feature_groups/";
document.getElementsByClassName("md-tabs__link")[1].href = "https://colab.research.google.com/github/logicalclocks/hopsworks-tutorials/blob/master/quickstart.ipynb";
document.getElementsByClassName("md-tabs__link")[2].href = "https://docs.hopsworks.ai/" + majorVersion + "/tutorials/";
document.getElementsByClassName("md-tabs__link")[3].href = "https://docs.hopsworks.ai/" + majorVersion + "/concepts/hopsworks/";
document.getElementsByClassName("md-tabs__link")[4].href = "https://docs.hopsworks.ai/" + majorVersion + "/user_guides/";
document.getElementsByClassName("md-tabs__link")[5].href = "https://docs.hopsworks.ai/" + majorVersion + "/setup_installation/aws/getting_started/";
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ nav:

theme:
name: material
custom_dir: overrides
custom_dir: docs/overrides
favicon: assets/images/favicon.ico
logo: assets/images/hops-logo.png
icon:
Expand All @@ -293,6 +293,7 @@ theme:
code: "IBM Plex Mono"
palette:
accent: teal
scheme: hopsworks
features:
- navigation.tabs
- navigation.tabs.sticky
Expand Down

0 comments on commit 4abef46

Please sign in to comment.