Skip to content

Commit 034b452

Browse files
author
Audrey Sage Lorberfeld
authored
Merge branch 'main' into audrey/pushed-only-changesets
2 parents 0ea6575 + 29ab8ae commit 034b452

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

src/components/Layout.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
'use client';
22

3-
import {Hero} from '@/components/Hero';
4-
import {Logo} from '@/components/Logo';
5-
import {MobileNavigation} from '@/components/MobileNavigation';
6-
import {Navigation} from '@/components/Navigation';
7-
import {ThemeSelector} from '@/components/ThemeSelector';
3+
import { Hero } from '@/components/Hero';
4+
import { Logo } from '@/components/Logo';
5+
import { MobileNavigation } from '@/components/MobileNavigation';
6+
import { Navigation } from '@/components/Navigation';
7+
import { ThemeSelector } from '@/components/ThemeSelector';
88
import clsx from 'clsx';
99
import Link from 'next/link';
10-
import {usePathname} from 'next/navigation';
11-
import {useEffect, useState} from 'react';
12-
import {LogoMark} from './LogoMark';
10+
import { usePathname } from 'next/navigation';
11+
import { useEffect, useState } from 'react';
12+
import { LogoMark } from './LogoMark';
13+
import { Search } from './search/Search';
1314
import VersionSelector from './VersionSelector';
14-
import {Search} from './search/Search';
1515

1616
function GitHubIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
1717
return (
@@ -29,7 +29,7 @@ function Header() {
2929
setIsScrolled(window.scrollY > 0);
3030
}
3131
onScroll();
32-
window.addEventListener('scroll', onScroll, {passive: true});
32+
window.addEventListener('scroll', onScroll, { passive: true });
3333
return () => {
3434
window.removeEventListener('scroll', onScroll);
3535
};
@@ -99,7 +99,7 @@ function Header() {
9999
);
100100
}
101101

102-
export function Layout({children}: {children: React.ReactNode}) {
102+
export function Layout({ children }: { children: React.ReactNode }) {
103103
let pathname = usePathname();
104104
let isHomePage = pathname === '/';
105105
let isCodyDocs = pathname.includes('/cody');
@@ -110,13 +110,14 @@ export function Layout({children}: {children: React.ReactNode}) {
110110
<Header />
111111

112112
{/* Cody docs banner */}
113-
{/* {isCodyDocs && !isopenCtxDocs && <TopBanner
113+
{/*isCodyDocs && !isopenCtxDocs && <TopBanner
114114
text="NEW: Introducing chat and search in a single input with Sourcegraph 6.0."
115115
link="https://sourcegraph.com/blog/combining-chat-and-search"
116116
linkText="Read here"
117117
textColor="#ffffff"
118118
backgroundColor="#F34E3F"
119-
/>} */}
119+
opacity='0.80'
120+
/>/*}
120121
121122
{/* Openctx docs banner */}
122123
{/* {isopenCtxDocs && <TopBanner

src/components/TopBanner.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ interface TopBannerProps {
99
backgroundColor?: string;
1010
textColor?: string;
1111
linkText?: string;
12+
opacity?: string;
13+
}
14+
15+
const hexToRgb = (hex: string) => {
16+
hex = hex.replace(/^#/, '');
17+
const r = parseInt(hex.slice(0, 2), 16);
18+
const g = parseInt(hex.slice(2, 4), 16);
19+
const b = parseInt(hex.slice(4, 6), 16);
20+
21+
return `${r}, ${g}, ${b}`;
1222
}
1323

1424
export function TopBanner({
@@ -17,14 +27,15 @@ export function TopBanner({
1727
backgroundColor = "#F34E3F",
1828
textColor = "white",
1929
linkText = 'new docs',
30+
opacity = '1'
2031
}: TopBannerProps) {
2132
const [isVisible, setIsVisible] = useState(true);
2233

2334
if (!isVisible) return null;
2435

2536
return (
2637
<div
27-
style={{ backgroundColor, color: textColor }}
38+
style={{ backgroundColor: `rgba(${hexToRgb(backgroundColor)}, ${opacity})`, color: textColor }}
2839
className="fixed top-0 z-[100] min-h-[42px] w-full flex items-center justify-center px-4 py-2 md:py-0 md:h-[42px]"
2940
>
3041
<div className="flex items-center gap-2 text-xs sm:text-sm max-w-[90%] md:max-w-none text-center">

0 commit comments

Comments
 (0)