Skip to content

Promotional banners #3118

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

Merged
merged 3 commits into from
May 14, 2024
Merged
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
32 changes: 32 additions & 0 deletions client/modules/IDE/pages/IDEView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,37 @@ function WarnIfUnsavedChanges() {
);
}

function Banner() {
// temporary banner to display funding opportunities
const [textObj, setTextObj] = useState({});

useEffect(() => {
const grant1 = {
copy:
'Learn to make art with AI with the Social Software High School Summer Institute. Apply by June 1!',
url: 'https://summer.ucla.edu/program/social-software-summer-institute/'
};

const grant2 = {
copy:
'Join us in contributing to p5.js——receive a $10,000 opportunity to grow within the contributor community!',
url: 'https://processingfoundation.org/grants'
};

const allMessages = [grant1, grant2];
const randomIndex = Math.floor(Math.random() * allMessages.length);
const randomMessage = allMessages[randomIndex];

setTextObj(randomMessage);
}, []);

return (
<div className="banner">
<a href={textObj.url}>{textObj.copy}</a>
</div>
);
}

export const CmControllerContext = React.createContext({});

const IDEView = () => {
Expand Down Expand Up @@ -170,6 +201,7 @@ const IDEView = () => {
<Helmet>
<title>{getTitle(project)}</title>
</Helmet>
<Banner />
<IDEKeyHandlers getContent={() => cmRef.current?.getContent()} />
<WarnIfUnsavedChanges />
<Toast />
Expand Down
13 changes: 13 additions & 0 deletions client/styles/layout/_ide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
width: 100%;
}

.banner {
width: 100%;
min-height: 2.2rem;
text-align: center;
padding: 0.5rem;
font-weight: bold;
border-bottom: 1px dashed #A6A6A6;

@media (max-width: 770px) {
min-height: 3.3rem;
}
}

.sidebar {
width: 100%;
height: 100%;
Expand Down
Loading