diff --git a/src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx b/src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx index b9febf5d54..20a646afcc 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx +++ b/src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx @@ -12,11 +12,37 @@ import { useGeneratedHtmlId, IconType, EuiThemeComputed, - EuiButton, } from '@elastic/eui' import { css } from '@emotion/react' import { useState } from 'react' +export const headerButtonCss = (euiTheme: EuiThemeComputed) => css` + background: linear-gradient(to bottom, #f5f7fa 0%, #ffffff 100%); + border: 1px solid ${euiTheme.colors.lightShade}; + border-radius: ${euiTheme.border.radius.small}; + color: ${euiTheme.colors.textInk}; + font-family: + ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, + 'Liberation Mono', 'Courier New', monospace; + font-size: 14px; + font-weight: 400; + padding: ${euiTheme.size.xs} ${euiTheme.size.m}; + cursor: pointer; + display: inline-flex; + align-items: center; + gap: ${euiTheme.size.s}; + text-decoration: none; + transition: + background 0.15s ease, + border-color 0.15s ease, + color 0.15s ease; + &:hover { + background: ${euiTheme.colors.primary}; + border-color: ${euiTheme.colors.primary}; + color: white; + } +` + interface DeploymentInfoProps { gitBranch: string gitCommit: string @@ -43,45 +69,35 @@ export const DeploymentInfo = ({ const popoverButton = ( - setIsOpen((prev) => !prev)} css={css` + ${headerButtonCss(euiTheme)}; margin-inline: ${euiTheme.size.s}; - font-family: ${euiTheme.font.familyCode}; `} > - + + {gitBranch} + + - - - {gitBranch} - - - - {gitCommit} - - - + + {gitCommit} + + ) @@ -181,7 +197,9 @@ const DeploymentInfoRow = ({ size="xs" css={css` color: ${euiTheme.colors.textInk}; - font-family: ${euiTheme.font.familyCode}; + font-family: + ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, + 'Liberation Mono', 'Courier New', monospace; `} > {value} diff --git a/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx b/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx index e9a710874f..39e0c071b9 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx +++ b/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx @@ -1,9 +1,10 @@ import '../../eui-icons-cache' import { useHtmxContainer } from '../shared/htmx/useHtmxContainer' -import { DeploymentInfo } from './DeploymentInfo' +import { DeploymentInfo, headerButtonCss } from './DeploymentInfo' import { EuiHeader, EuiHeaderLogo, + EuiIcon, EuiProvider, useEuiTheme, } from '@elastic/eui' @@ -28,6 +29,7 @@ export const Header = ({ title, logoHref, githubRepository, + githubLink, gitBranch, gitCommit, githubRef, @@ -45,7 +47,13 @@ export const Header = ({ > span { - color: var(--color-white); + color: ${euiTheme.colors.textInk}; } `} > @@ -68,6 +89,28 @@ export const Header = ({ ? [ { items: [ + ...(githubLink + ? [ + + + GitHub + , + ] + : []), *@ - @* @Model.Title *@ - @* *@ + @* index page surfaces as the first nav item via _TocTreeNav *@ } diff --git a/src/Elastic.Documentation.Site/Navigation/_TocTreeNav.cshtml b/src/Elastic.Documentation.Site/Navigation/_TocTreeNav.cshtml index ae8928c918..050262b088 100644 --- a/src/Elastic.Documentation.Site/Navigation/_TocTreeNav.cshtml +++ b/src/Elastic.Documentation.Site/Navigation/_TocTreeNav.cshtml @@ -6,6 +6,19 @@ @{ var isTopLevel = Model.Level == 0; } +@if (isTopLevel && !Model.IsGlobalAssemblyBuild && !Model.IsPrimaryNavEnabled && !Model.SubTree.Index.Hidden) +{ + var idx = Model.SubTree.Index; + + + @idx.NavigationTitle + + +} @foreach (var item in Model.SubTree.NavigationItems) { if (item.Hidden) diff --git a/src/Elastic.Markdown/HtmlWriter.cs b/src/Elastic.Markdown/HtmlWriter.cs index cd1d29ccf0..b2bcfa7e05 100644 --- a/src/Elastic.Markdown/HtmlWriter.cs +++ b/src/Elastic.Markdown/HtmlWriter.cs @@ -162,7 +162,7 @@ private async Task RenderLayout(MarkdownFile markdown, MarkdownDoc SiteRootPath = DocumentationSet.Context.SiteRootPath, AppliesTo = markdown.YamlFrontMatter?.AppliesTo, GithubEditUrl = editUrl, - MarkdownUrl = current.Url.TrimEnd('/') + ".md", + MarkdownUrl = current.Url == "/" ? "/index.md" : current.Url.TrimEnd('/') + ".md", AllowIndexing = DocumentationSet.Context.AllowIndexing && markdown.YamlFrontMatter?.NoIndex != true && (markdown.CrossLink.Equals("docs-content://index.md", StringComparison.OrdinalIgnoreCase) || markdown is DetectionRuleFile || !current.Hidden), CanonicalBaseUrl = DocumentationSet.Context.CanonicalBaseUrl, GoogleTagManager = DocumentationSet.Context.GoogleTagManager, diff --git a/src/Elastic.Markdown/Layout/_Breadcrumbs.cshtml b/src/Elastic.Markdown/Layout/_Breadcrumbs.cshtml index 61de6bd6a1..0ee990d0be 100644 --- a/src/Elastic.Markdown/Layout/_Breadcrumbs.cshtml +++ b/src/Elastic.Markdown/Layout/_Breadcrumbs.cshtml @@ -4,6 +4,8 @@ var crumbs = targets.ToList(); } +@if (crumbs.Count > 0 && (crumbs.Count > 1 || Model.BuildType != BuildType.Isolated)) +{ @for (var i = 0; i < crumbs.Count; i++) { @@ -23,3 +25,4 @@ } +} diff --git a/src/Elastic.Markdown/Layout/_TableOfContents.cshtml b/src/Elastic.Markdown/Layout/_TableOfContents.cshtml index e21a1add27..542e8fc64e 100644 --- a/src/Elastic.Markdown/Layout/_TableOfContents.cshtml +++ b/src/Elastic.Markdown/Layout/_TableOfContents.cshtml @@ -3,7 +3,7 @@ @inherits RazorSlice