Skip to content

Commit 2817aed

Browse files
committed
update styling and copy
1 parent bf7518f commit 2817aed

File tree

3 files changed

+131
-93
lines changed

3 files changed

+131
-93
lines changed

client/common/BannerMock.jsx

Lines changed: 109 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
/* eslint-disable jsx-a11y/accessible-emoji */
22
import React, { useState } from 'react';
3-
import styled, { keyframes } from 'styled-components';
4-
5-
const fadeOut = keyframes`
6-
from { opacity: 1; transform: scale(1); }
7-
to { opacity: 0; transform: scale(0.95); }
8-
`;
3+
import { useCollapse } from 'react-collapsed';
4+
import styled from 'styled-components';
95

106
const Banner = styled.div`
117
font-family: 'Space Grotesk', sans-serif;
128
background: white;
139
font-size: 1.125rem;
1410
position: relative;
15-
transition: opacity 0.5s ease, transform 0.5s ease;
16-
animation: ${({ hidden }) => (hidden ? fadeOut : 'none')} 0.5s forwards;
11+
overflow: hidden;
1712
`;
1813

1914
const Container = styled.div`
@@ -24,41 +19,47 @@ const Container = styled.div`
2419
`;
2520

2621
const DarkSideBar = styled.div`
27-
width: 20px;
22+
width: 30px;
2823
background: #aa1d47;
2924
`;
3025

3126
const CallToAction = styled.div`
3227
flex: 2;
33-
padding: 2rem 2.5rem;
28+
padding: 1rem 3rem;
3429
display: flex;
3530
flex-direction: column;
3631
z-index: 1;
3732
position: relative;
3833
34+
h1 {
35+
font-size: 2.5rem;
36+
}
37+
3938
p {
40-
margin-bottom: 1rem;
39+
margin: 0.5rem 0;
40+
font-size: 1.3rem;
4141
}
4242
4343
ul {
44-
margin-top: 1rem;
44+
margin: 0.5rem;
45+
font-size: 1.3rem;
4546
}
4647
`;
4748

4849
const ChevronWrapper = styled.div`
49-
width: 80px;
50-
background: linear-gradient(to bottom, #ed225d 0%, #d31f52 100%);
51-
clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%);
50+
width: 90px;
51+
background: linear-gradient(to bottom, #ed225d 0%, #aa1d47 100%);
52+
clip-path: polygon(0 0, 100% 0, 30% 50%, 100% 100%, 0 100%);
5253
z-index: 0;
53-
transform: rotateY(3.142rad);
54+
transform: rotateY(3.142rad); /* keep flip as intended */
5455
@media (max-width: 850px) {
5556
display: none;
5657
}
5758
`;
5859

5960
const Action = styled.div`
6061
flex: 1;
61-
padding: 2rem;
62+
padding: 4rem;
6263
display: flex;
6364
flex-direction: column;
6465
gap: 1rem;
@@ -70,6 +71,8 @@ const IntervalSelect = styled.div`
7071
background: #f1f5f9;
7172
border-radius: 6px;
7273
padding: 0.5rem;
74+
margin: 0 3rem;
75+
font-size: 1.2rem;
7376
`;
7477

7578
const Interval = styled.div`
@@ -81,7 +84,6 @@ const Interval = styled.div`
8184
8285
&.active {
8386
background: white;
84-
font-weight: bold;
8587
}
8688
8789
&:hover {
@@ -96,12 +98,13 @@ const AmountSelect = styled.div`
9698
`;
9799

98100
const Amount = styled.div`
99-
padding: 0.5rem 1rem;
101+
padding: 1rem;
100102
text-align: center;
101103
border-radius: 6px;
102104
border: 1px solid #94a3b8;
103105
cursor: pointer;
104106
background: ${({ active }) => (active ? '#f1f5f9' : 'white')};
107+
font-weight: ${({ active }) => (active ? 'bold' : 'normal')};
105108
transition: background 0.2s, transform 0.1s;
106109
107110
&:hover {
@@ -135,7 +138,7 @@ const DonateButton = styled.button`
135138
`;
136139

137140
const MoreInfo = styled.div`
138-
font-size: 0.9rem;
141+
font-size: 1.3rem;
139142
text-align: center;
140143
color: #64748b;
141144
`;
@@ -161,8 +164,10 @@ const CloseButton = styled.button`
161164
const SkipContainer = styled.button`
162165
align-self: flex-end;
163166
margin-top: auto;
167+
margin-bottom: 1rem;
164168
color: #64748b;
165-
font-size: 0.9rem;
169+
font-size: 1.1rem;
170+
font-weight: 500;
166171
background: none;
167172
border: none;
168173
cursor: pointer;
@@ -175,87 +180,98 @@ const SkipContainer = styled.button`
175180

176181
export default function BannerMockup() {
177182
const [visible, setVisible] = useState(true);
178-
const [hidden, setHidden] = useState(false);
183+
const [isExpanded, setExpanded] = useState(true);
184+
const { getCollapseProps } = useCollapse({
185+
isExpanded,
186+
duration: 1500,
187+
onCollapseEnd: () => setVisible(false)
188+
});
179189
const [selectedInterval, setSelectedInterval] = useState('monthly');
180190
const [selectedAmount, setSelectedAmount] = useState(10);
181191

182192
const amounts = [5, 10, 25, 55];
183193

184-
const closeBanner = () => {
185-
setHidden(true);
186-
setTimeout(() => setVisible(false), 500);
187-
};
194+
const closeBanner = () => setExpanded(false);
188195

189196
if (!visible) return null;
190197

191198
return (
192-
<Banner hidden={hidden}>
193-
<CloseButton onClick={closeBanner}>&times;</CloseButton>
194-
<Container>
195-
<DarkSideBar />
196-
<CallToAction>
197-
<h1>👋 😄 Keep p5.js Awesome (and Private)</h1>
198-
<p>
199-
<strong>Private sketches are coming to p5.js!</strong> Soon you’ll
200-
be able to keep your work-in-progress just that: private. Whether
201-
you’re a student trying things out, a teacher setting up lessons, or
202-
an artist prototyping your next big idea, you’ll be able to sketch
203-
in peace, on your own terms.
204-
</p>
205-
<p>
206-
But features like this don’t build themselves. If every caring p5.js
207-
creator like you buys us a coffee every month, we’ll be able to keep
208-
building:
209-
</p>
210-
<ul>
211-
<li>✏️ Student and teacher-friendly features</li>
212-
<li>♿ Accessibility tools for all users</li>
213-
<li>⚡ Faster, smoother performance</li>
214-
<li>💖 A creative coding platform that’s free and open forever</li>
215-
</ul>
216-
<SkipContainer onClick={closeBanner}>
217-
✔️ I already donated
218-
</SkipContainer>
219-
</CallToAction>
220-
221-
<ChevronWrapper />
222-
223-
<Action>
224-
<IntervalSelect>
225-
<Interval
226-
className={selectedInterval === 'onetime' ? 'active' : ''}
227-
onClick={() => setSelectedInterval('onetime')}
228-
>
229-
One-time
230-
</Interval>
231-
<Interval
232-
className={selectedInterval === 'monthly' ? 'active' : ''}
233-
onClick={() => setSelectedInterval('monthly')}
234-
>
235-
⭐ Monthly
236-
</Interval>
237-
</IntervalSelect>
238-
239-
<AmountSelect>
240-
{amounts.map((amt) => (
241-
<Amount
242-
key={amt}
243-
active={selectedAmount === amt}
244-
onClick={() => setSelectedAmount(amt)}
199+
<div {...getCollapseProps()}>
200+
<Banner>
201+
<CloseButton onClick={closeBanner}>&times;</CloseButton>
202+
<Container>
203+
<DarkSideBar />
204+
<CallToAction>
205+
<h1>👋 😄 Keep p5.js Awesome (and Private)</h1>
206+
<p>
207+
<strong>Private sketches are coming to p5.js!</strong> Soon you’ll
208+
be able to keep your work-in-progress just that: private. Whether
209+
you’re a student trying things out, a teacher setting up lessons,
210+
or an artist prototyping your next big idea, you’ll be able to
211+
sketch on your own terms before sharing with the world.
212+
</p>
213+
<p>
214+
But features like this don’t build themselves. If every caring
215+
p5.js creator chips in the cost of a coffee each month, we’ll be
216+
able to keep building:
217+
</p>
218+
<ul>
219+
<li>✏️ Student and teacher-friendly features</li>
220+
<li>♿ Accessibility tools for all users</li>
221+
<li>⚡ Faster, smoother performance</li>
222+
<li>
223+
💖 A creative coding platform that’s free and open forever
224+
</li>
225+
</ul>
226+
<p>
227+
p5.js cares about your data privacy. We don’t collect personal
228+
info like gender or birthdate. Learn more about our{' '}
229+
<a href="/privacy-policy">Privacy Policy</a>.
230+
</p>
231+
<SkipContainer onClick={closeBanner}>
232+
✔️ I already donated
233+
</SkipContainer>
234+
</CallToAction>
235+
236+
<ChevronWrapper />
237+
238+
<Action>
239+
<IntervalSelect>
240+
<Interval
241+
className={selectedInterval === 'onetime' ? 'active' : ''}
242+
onClick={() => setSelectedInterval('onetime')}
243+
>
244+
One-time
245+
</Interval>
246+
<Interval
247+
className={selectedInterval === 'monthly' ? 'active' : ''}
248+
onClick={() => setSelectedInterval('monthly')}
245249
>
246-
${amt}
247-
</Amount>
248-
))}
249-
<CustomAmount placeholder="Other amount" />
250-
</AmountSelect>
251-
252-
<DonateButton>Donate Now – it takes 30 seconds!</DonateButton>
253-
<MoreInfo>
254-
$5 makes a difference. $55 makes our day. <br />
255-
Let’s keep creative coding open to all.
256-
</MoreInfo>
257-
</Action>
258-
</Container>
259-
</Banner>
250+
⭐ Monthly
251+
</Interval>
252+
</IntervalSelect>
253+
254+
<AmountSelect>
255+
{amounts.map((amt) => (
256+
<Amount
257+
key={amt}
258+
active={selectedAmount === amt}
259+
onClick={() => setSelectedAmount(amt)}
260+
>
261+
${amt}
262+
</Amount>
263+
))}
264+
<CustomAmount placeholder="Other amount" />
265+
</AmountSelect>
266+
267+
<DonateButton>Donate Now – it takes 30 seconds!</DonateButton>
268+
<MoreInfo>
269+
$5 makes a difference. $55 makes our day. <br />
270+
Let’s keep creative coding open to all.
271+
</MoreInfo>
272+
</Action>
273+
</Container>
274+
</Banner>
275+
</div>
260276
);
261277
}

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@
228228
"query-string": "^6.14.1",
229229
"raw-loader": "^4.0.2",
230230
"react": "^16.14.0",
231+
"react-collapsed": "^4.2.0",
231232
"react-dom": "^16.14.0",
232233
"react-final-form": "^6.5.3",
233234
"react-ga": "^3.3.0",

0 commit comments

Comments
 (0)