Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conditional rendering based on the showBanner state #7038

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export const Banner: FunctionComponent<{}> = () => (
<div className="sg-border-gradient-banner z-[1000] border-b-1 bg-black py-[13px]">
<div className="mx-auto flex max-w-screen-xl flex-col items-center justify-center gap-y-[9px] gap-x-12 px-2 md:flex-row">
<p className="mb-0 text-center font-semibold leading-[22px] text-white">
Join us for a live Q&A session with the co-founders on June 25th!
Claude 3.5 Sonnet is now available for Cody
</p>
<Link
href="https://discord.gg/nyFC7Gah?event=1252715837614461012"
title="Join us for a live Q&A session with the co-founders on Discord!"
href="https://sourcegraph.com/blog/claude-3.5-sonnet-now-available-in-cody"
title="Claude 3.5 Sonnet is now available for Cody"
className="btn bg-transparent !px-0 !py-0 leading-[22px] text-violet-300"
target="_blank"
>
RSVP in Discord
Learn more
<ChevronRightIcon className="!mb-0 ml-[6px] inline" />
</Link>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Layout/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const Header: FunctionComponent<Props> = ({ minimal, colorTheme, navRef }
const [sticky, setSticky] = useState<boolean>(false)
const router = useRouter()
const { pathname } = router
const [showBanner, setShowBanner] = useState(false)

const source = pathname.slice(1) || 'about-home'

Expand Down Expand Up @@ -56,7 +57,7 @@ export const Header: FunctionComponent<Props> = ({ minimal, colorTheme, navRef }
<Disclosure as="nav" className={classNames('fixed top-0 left-0 right-0 z-[1030]')} ref={navRef}>
{({ open, close }) => (
<>
<Banner />
{showBanner && <Banner />}
<HeaderContent
colorTheme={colorTheme}
minimal={minimal}
Expand Down
Loading