Skip to content

Commit bdebdbb

Browse files
authored
Merge pull request #3118 from processing/promotional-banners
Promotional banners
2 parents caa7626 + 7c66329 commit bdebdbb

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

client/modules/IDE/pages/IDEView.jsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,37 @@ function WarnIfUnsavedChanges() {
8787
);
8888
}
8989

90+
function Banner() {
91+
// temporary banner to display funding opportunities
92+
const [textObj, setTextObj] = useState({});
93+
94+
useEffect(() => {
95+
const grant1 = {
96+
copy:
97+
'Learn to make art with AI with the Social Software High School Summer Institute. Apply by June 1!',
98+
url: 'https://summer.ucla.edu/program/social-software-summer-institute/'
99+
};
100+
101+
const grant2 = {
102+
copy:
103+
'Join us in contributing to p5.js——receive a $10,000 opportunity to grow within the contributor community!',
104+
url: 'https://processingfoundation.org/grants'
105+
};
106+
107+
const allMessages = [grant1, grant2];
108+
const randomIndex = Math.floor(Math.random() * allMessages.length);
109+
const randomMessage = allMessages[randomIndex];
110+
111+
setTextObj(randomMessage);
112+
}, []);
113+
114+
return (
115+
<div className="banner">
116+
<a href={textObj.url}>{textObj.copy}</a>
117+
</div>
118+
);
119+
}
120+
90121
export const CmControllerContext = React.createContext({});
91122

92123
const IDEView = () => {
@@ -170,6 +201,7 @@ const IDEView = () => {
170201
<Helmet>
171202
<title>{getTitle(project)}</title>
172203
</Helmet>
204+
<Banner />
173205
<IDEKeyHandlers getContent={() => cmRef.current?.getContent()} />
174206
<WarnIfUnsavedChanges />
175207
<Toast />

client/styles/layout/_ide.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@
1616
width: 100%;
1717
}
1818

19+
.banner {
20+
width: 100%;
21+
min-height: 2.2rem;
22+
text-align: center;
23+
padding: 0.5rem;
24+
font-weight: bold;
25+
border-bottom: 1px dashed #A6A6A6;
26+
27+
@media (max-width: 770px) {
28+
min-height: 3.3rem;
29+
}
30+
}
31+
1932
.sidebar {
2033
width: 100%;
2134
height: 100%;

0 commit comments

Comments
 (0)