Skip to content

Commit bc6c8c0

Browse files
authored
ux: Updates announcement banner to Reviewer (#386)
* Changes top announcementbanner to be more reusable and changes content to be about the reviewer * Visual tweak * Typo * Undo asdf shennaniggans
1 parent 1381dc5 commit bc6c8c0

File tree

3 files changed

+139
-2
lines changed

3 files changed

+139
-2
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import React, { useState, useEffect } from 'react';
2+
import { VscGitPullRequest, VscClose } from 'react-icons/vsc';
3+
import styles from './styles.module.css';
4+
5+
// Change this key whenever you change the banner
6+
// to announce something new
7+
const BANNER_DISMISSED_KEY = 'reviewer-banner-dismissed';
8+
9+
export function AnnouncementBanner() {
10+
const [isVisible, setIsVisible] = useState(false);
11+
12+
useEffect(() => {
13+
// Check if banner was previously dismissed
14+
const isDismissed = localStorage.getItem(BANNER_DISMISSED_KEY);
15+
if (!isDismissed) {
16+
setIsVisible(true);
17+
}
18+
}, []);
19+
20+
const handleDismiss = () => {
21+
setIsVisible(false);
22+
localStorage.setItem(BANNER_DISMISSED_KEY, 'true');
23+
};
24+
25+
if (!isVisible) {
26+
return null;
27+
}
28+
29+
return (
30+
<div className={styles.announcementBanner} role="complementary" aria-label="Product announcement">
31+
<div className={styles.bannerContent}>
32+
<VscGitPullRequest size={20} color="#ffffff" />
33+
<span className={styles.bannerHeadline}>
34+
Get comprehensive, actionable reviews directly in your PRs.
35+
</span>
36+
<a
37+
className={styles.bannerLink}
38+
href="https://roocode.com/reviewer?utm_source=docs&utm_medium=banner&utm_campaign=reviewer_promo"
39+
target="_blank"
40+
rel="noopener noreferrer">
41+
Try Roo&apos;s PR Reviewer
42+
</a>
43+
<button
44+
className={styles.dismissButton}
45+
onClick={handleDismiss}
46+
aria-label="Dismiss announcement"
47+
type="button">
48+
<VscClose size={18} />
49+
</button>
50+
</div>
51+
</div>
52+
);
53+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
.announcementBanner {
2+
position: relative;
3+
width: 100%;
4+
background: linear-gradient(90deg, #4f46e5, #2563eb);
5+
border-bottom: 1px solid rgba(147, 197, 253, 0.5);
6+
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
7+
}
8+
9+
.bannerContent {
10+
display: flex;
11+
align-items: center;
12+
justify-content: center;
13+
gap: 0.75rem;
14+
padding: 0.75rem 3rem;
15+
color: #ffffff;
16+
position: relative;
17+
}
18+
19+
.bannerHeadline {
20+
font-weight: 600;
21+
font-size: 0.95rem;
22+
}
23+
24+
.bannerLink {
25+
color: #ffffff;
26+
font-weight: 600;
27+
font-size: 0.95rem;
28+
text-decoration: underline;
29+
text-decoration-color: rgba(255, 255, 255, 0.7);
30+
text-decoration-thickness: 2px;
31+
transition: text-decoration-color 0.2s ease;
32+
}
33+
34+
.bannerLink:hover {
35+
color: #ffffff;
36+
text-decoration-color: rgba(255, 255, 255, 0.95);
37+
}
38+
39+
.dismissButton {
40+
position: absolute;
41+
right: 1rem;
42+
top: 1.5rem;
43+
transform: translateY(-50%);
44+
background: transparent;
45+
border: none;
46+
color: #ffffff;
47+
cursor: pointer;
48+
padding: 0.25rem;
49+
display: flex;
50+
align-items: center;
51+
justify-content: center;
52+
border-radius: 4px;
53+
transition: background-color 0.2s ease;
54+
}
55+
56+
.dismissButton:hover {
57+
background-color: rgba(255, 255, 255, 0.1);
58+
}
59+
60+
.dismissButton:focus {
61+
outline: 2px solid rgba(255, 255, 255, 0.5);
62+
outline-offset: 2px;
63+
}
64+
65+
@media (max-width: 768px) {
66+
.bannerContent {
67+
flex-direction: column;
68+
gap: 0.5rem;
69+
padding: 1rem 3rem 1rem 1rem;
70+
align-items: flex-start;
71+
}
72+
73+
.bannerHeadline {
74+
font-size: 0.875rem;
75+
}
76+
77+
.bannerLink {
78+
font-size: 0.875rem;
79+
}
80+
81+
.dismissButton {
82+
right: 0.5rem;
83+
}
84+
}

src/theme/Layout/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import OriginalLayout from '@theme-original/Layout';
33
import { CookieConsent } from '../../components/CookieConsent';
44
import { PostHogProvider } from '../../components/PostHogProvider';
55
import { IntercomProvider } from '../../components/IntercomProvider';
6-
import { TeamsBanner } from '../../components/TeamsBanner';
6+
import { AnnouncementBanner } from '../../components/AnnouncementBanner';
77

88
export default function Layout(props) {
99
return (
1010
<PostHogProvider>
1111
<IntercomProvider>
12-
<TeamsBanner />
12+
<AnnouncementBanner />
1313
<OriginalLayout {...props} />
1414
<CookieConsent />
1515
</IntercomProvider>

0 commit comments

Comments
 (0)