diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index b0d3ac8bd..592a2834e 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 ( @@ -103,11 +104,31 @@ function Header() { export function Layout({ children }: { children: React.ReactNode }) { let pathname = usePathname(); let isHomePage = pathname === '/'; + let isCodyDocs = pathname.includes('/cody'); + let isopenCtxDocs = pathname.includes('/cody/capabilities/openctx'); return (
+ {/* Cody docs banner */} + {/* {isCodyDocs && !isopenCtxDocs && } */} + + {/* Openctx docs banner */} + {isopenCtxDocs && } + {isHomePage && } {/* {isHomePage && } */} diff --git a/src/components/TopBanner.tsx b/src/components/TopBanner.tsx new file mode 100644 index 000000000..0190e1996 --- /dev/null +++ b/src/components/TopBanner.tsx @@ -0,0 +1,60 @@ +'use client'; + +import Link from 'next/link'; +import { useState } from 'react'; + +interface TopBannerProps { + text?: string; + link?: string; + backgroundColor?: string; + textColor?: string; + linkText?: string; +} + +export function TopBanner({ + text = "", + link = "https://sourcegraph.com/", + backgroundColor = "#F34E3F", + textColor = "white", + linkText = 'new docs', +}: TopBannerProps) { + const [isVisible, setIsVisible] = useState(true); + + if (!isVisible) return null; + + return ( +
+
+ {text} + + {linkText && {linkText}} + + + + + +
+ +
+ ); +}