Skip to content

Commit 28fb954

Browse files
committed
alternative widget option
1 parent e1aa530 commit 28fb954

File tree

2 files changed

+47
-57
lines changed

2 files changed

+47
-57
lines changed

client/modules/IDE/pages/IDEView.jsx

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,11 @@ const IDEView = () => {
116116
};
117117

118118
const Banner = () => {
119-
// temporary banner to display funding opportunities
120-
const textObj = {
121-
copy:
122-
'Help us raise $20K to continue our mission of building equitable and accessible creative coding tools!',
123-
url: 'https://p5js.org/donate/'
124-
};
125-
126119
const [isBannerVisible, setIsBannerVisible] = useState(true);
127120

128-
// eslint-disable-next-line consistent-return
129121
useEffect(() => {
122+
if (!isBannerVisible) return;
123+
130124
const script = document.createElement('script');
131125
script.type = 'text/javascript';
132126
script.defer = true;
@@ -148,6 +142,7 @@ const IDEView = () => {
148142

149143
document.body.appendChild(script);
150144

145+
// eslint-disable-next-line consistent-return
151146
return () => {
152147
const existingScript = document.getElementById(
153148
'donorbox-popup-button-installer'
@@ -156,7 +151,7 @@ const IDEView = () => {
156151
existingScript.remove();
157152
}
158153
};
159-
}, []);
154+
}, [isBannerVisible]);
160155

161156
const handleCloseBanner = () => {
162157
setIsBannerVisible(false);
@@ -174,18 +169,49 @@ const IDEView = () => {
174169
}
175170
};
176171

177-
return (
178-
isBannerVisible && (
179-
<div className="banner">
180-
<a href={textObj.url} target="_blank" rel="noopener noreferrer">
181-
{textObj.copy}
182-
</a>
183-
<button className="banner-close-button" onClick={handleCloseBanner}>
184-
<CrossIcon />
185-
</button>
186-
</div>
187-
)
188-
);
172+
return isBannerVisible ? (
173+
<div
174+
style={{
175+
position: 'fixed',
176+
top: '0',
177+
right: '23%',
178+
zIndex: 10000,
179+
display: 'flex',
180+
alignItems: 'center',
181+
gap: '10px',
182+
padding: '8px 18px',
183+
borderRadius: '5px'
184+
}}
185+
>
186+
<button
187+
style={{
188+
background: 'transparent',
189+
border: 'none',
190+
color: 'white',
191+
fontSize: '16px',
192+
cursor: 'pointer',
193+
display: 'flex',
194+
alignItems: 'center',
195+
fontFamily: 'Verdana, sans-serif',
196+
padding: '8px 22px 8px 18px',
197+
borderRadius: '0px 0px 5px 5px',
198+
gap: '8px',
199+
width: 'fit-content',
200+
lineHeight: '24px',
201+
position: 'fixed',
202+
top: '61%',
203+
left: '20px',
204+
transform: 'translate(-50%, -50%) rotate(-90deg)',
205+
zIndex: 9999,
206+
overflow: 'hidden'
207+
}}
208+
onClick={handleCloseBanner}
209+
aria-label="Close Banner"
210+
>
211+
<CrossIcon />
212+
</button>
213+
</div>
214+
) : null;
189215
};
190216

191217
useEffect(() => {

client/styles/layout/_ide.scss

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,6 @@
2121
height: 100%;
2222
}
2323

24-
.banner {
25-
width: 100%;
26-
min-height: 2.2rem;
27-
text-align: center;
28-
padding: 0.5rem;
29-
font-weight: bold;
30-
border-bottom: 1px dashed #A6A6A6;
31-
color: #FFF;
32-
33-
// @include themify() {
34-
// background-color: getThemifyVariable('logo-color');
35-
// & a {
36-
// color: getThemifyVariable('logo-background-color');
37-
// }
38-
// }
39-
40-
@media (max-width: 770px) {
41-
min-height: 3.3rem;
42-
}
43-
}
44-
45-
.banner-close-button {
46-
display: flex;
47-
flex-direction: column;
48-
align-items: center;
49-
justify-content: center;
50-
height: 20px;
51-
width:20px;
52-
float: right;
53-
54-
// & path {
55-
// @include themify() {
56-
// fill: getThemifyVariable('logo-background-color');
57-
// }
58-
// }
59-
}
6024

6125
@media print {
6226
.sidebar {

0 commit comments

Comments
 (0)