From 432c12521e57189ed8c2da2478d6ac71882dff9a Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Thu, 6 Feb 2020 13:49:35 -0500 Subject: [PATCH] [docs] Add menu w/ links to other pages on hf.co --- docs/source/_static/css/huggingface.css | 38 +++++++++++++++++++++++++ docs/source/_static/js/custom.js | 11 +++++++ 2 files changed, 49 insertions(+) diff --git a/docs/source/_static/css/huggingface.css b/docs/source/_static/css/huggingface.css index 3f006a996b..82cb5e5aa4 100644 --- a/docs/source/_static/css/huggingface.css +++ b/docs/source/_static/css/huggingface.css @@ -194,3 +194,41 @@ h2, .rst-content .toctree-wrapper p.caption, h3, h4, h5, h6, legend{ src: url(./Calibre-Thin.otf); font-weight:400; } + + +/** + * Nav Links to other parts of huggingface.co + */ + div.menu { + position: absolute; + top: 0; + right: 0; + padding-top: 20px; + padding-right: 20px; + z-index: 1000; +} +div.menu a { + font-size: 14px; + letter-spacing: 0.3px; + text-transform: uppercase; + color: white; + -webkit-font-smoothing: antialiased; + background: linear-gradient(0deg, #6671ffb8, #9a66ffb8 50%); + padding: 10px 16px 6px 16px; + border-radius: 3px; + margin-left: 12px; + position: relative; +} +div.menu a:active { + top: 1px; +} +@media (min-width: 768px) and (max-width: 1750px) { + .wy-breadcrumbs { + margin-top: 32px; + } +} +@media (max-width: 768px) { + div.menu { + display: none; + } +} diff --git a/docs/source/_static/js/custom.js b/docs/source/_static/js/custom.js index ec804b3704..04cdfc1de6 100644 --- a/docs/source/_static/js/custom.js +++ b/docs/source/_static/js/custom.js @@ -58,6 +58,16 @@ function addGithubButton() { document.querySelector(".wy-side-nav-search .icon-home").insertAdjacentHTML('afterend', div); } +function addHfMenu() { + const div = ` + + `; + document.body.insertAdjacentHTML('afterbegin', div); +} + /*! * github-buttons v2.2.10 * (c) 2019 ăȘă€ă @@ -74,6 +84,7 @@ function onLoad() { addCustomFooter(); addGithubButton(); parseGithubButtons(); + addHfMenu(); } window.addEventListener("load", onLoad);