From 7d41934c86ce02d73b8d2f39706a3b9e986c8b33 Mon Sep 17 00:00:00 2001 From: zahidalidev Date: Wed, 5 Feb 2025 01:03:40 +0500 Subject: [PATCH 1/2] Added top banner --- src/components/Layout.tsx | 3 ++ src/components/TopBanner.tsx | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/components/TopBanner.tsx diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index b0d3ac8bd..a31f31233 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -13,6 +13,7 @@ import { LogoMark } from './LogoMark'; import VersionSelector from './VersionSelector'; import { Search } from './search/Search'; import { DemoLayout } from '@/components/DemoLayout'; +import { TopBanner } from './TopBanner'; function GitHubIcon(props: React.ComponentPropsWithoutRef<'svg'>) { return ( @@ -100,12 +101,14 @@ function Header() { ); } + export function Layout({ children }: { children: React.ReactNode }) { let pathname = usePathname(); let isHomePage = pathname === '/'; return (
+
{isHomePage && } diff --git a/src/components/TopBanner.tsx b/src/components/TopBanner.tsx new file mode 100644 index 000000000..f08fd3942 --- /dev/null +++ b/src/components/TopBanner.tsx @@ -0,0 +1,60 @@ +'use client'; + +import { useState } from 'react'; +import Link from 'next/link'; + +interface TopBannerProps { + text?: string; + link?: string; + backgroundColor?: string; + textColor?: string; + linkText?: string; +} + +export function TopBanner({ + text = "", + link = "https://sourcegraph.com/", + backgroundColor = "#7834bb", + textColor = "white", + linkText = 'new docs', +}: TopBannerProps) { + const [isVisible, setIsVisible] = useState(true); + + if (!isVisible) return null; + + return ( +
+
+ {text} + + {linkText && {linkText}} + + + + + +
+ +
+ ); +} From a1f24713d6040f4b249a845fce6de5e8b17133d1 Mon Sep 17 00:00:00 2001 From: zahidalidev Date: Wed, 5 Feb 2025 22:15:41 +0500 Subject: [PATCH 2/2] Fixed issues with the search ui --- src/components/Layout.tsx | 3 - src/components/TopBanner.tsx | 60 ------------------- src/components/search/docsearch/docsearch.css | 3 - 3 files changed, 66 deletions(-) delete mode 100644 src/components/TopBanner.tsx diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index a31f31233..b0d3ac8bd 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -13,7 +13,6 @@ import { LogoMark } from './LogoMark'; import VersionSelector from './VersionSelector'; import { Search } from './search/Search'; import { DemoLayout } from '@/components/DemoLayout'; -import { TopBanner } from './TopBanner'; function GitHubIcon(props: React.ComponentPropsWithoutRef<'svg'>) { return ( @@ -101,14 +100,12 @@ function Header() { ); } - export function Layout({ children }: { children: React.ReactNode }) { let pathname = usePathname(); let isHomePage = pathname === '/'; return (
-
{isHomePage && } diff --git a/src/components/TopBanner.tsx b/src/components/TopBanner.tsx deleted file mode 100644 index f08fd3942..000000000 --- a/src/components/TopBanner.tsx +++ /dev/null @@ -1,60 +0,0 @@ -'use client'; - -import { useState } from 'react'; -import Link from 'next/link'; - -interface TopBannerProps { - text?: string; - link?: string; - backgroundColor?: string; - textColor?: string; - linkText?: string; -} - -export function TopBanner({ - text = "", - link = "https://sourcegraph.com/", - backgroundColor = "#7834bb", - textColor = "white", - linkText = 'new docs', -}: TopBannerProps) { - const [isVisible, setIsVisible] = useState(true); - - if (!isVisible) return null; - - return ( -
-
- {text} - - {linkText && {linkText}} - - - - - -
- -
- ); -} diff --git a/src/components/search/docsearch/docsearch.css b/src/components/search/docsearch/docsearch.css index c757155d2..1fd41a516 100644 --- a/src/components/search/docsearch/docsearch.css +++ b/src/components/search/docsearch/docsearch.css @@ -381,7 +381,6 @@ html.dark { z-index: 10; } .DocSearch-Hit-Tree { - color: var(--docsearch-muted-color); height: var(--docsearch-hit-height); opacity: 0.5; stroke-width: var(--docsearch-icon-stroke-width); @@ -407,7 +406,6 @@ html.dark { } .DocSearch-Hit-action, .DocSearch-Hit-icon { - color: var(--docsearch-muted-color); stroke-width: var(--docsearch-icon-stroke-width); } .DocSearch-Hit-action { @@ -472,7 +470,6 @@ svg.DocSearch-Hit-Select-Icon { font-size: 0.9em; } .DocSearch-Hit-path { - color: var(--docsearch-muted-color); font-size: 0.75em; } .DocSearch-Hit[aria-selected='true'] .DocSearch-Hit-action,