Skip to content

Commit abc884d

Browse files
committed
Update newsletter component
1 parent d808dcf commit abc884d

1 file changed

Lines changed: 54 additions & 39 deletions

File tree

packages/ui/src/components/newsletter.tsx

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const FooterNewsletterForm = ({
3131
subscribe,
3232
} = useNewsletter({ apiUrl });
3333

34-
const buttonText = blog ? "Sign up" : "Subscribe for updates";
34+
const buttonText = blog ? "Sign up" : "Subscribe";
3535

3636
const handleSubmit = async (event: React.FormEvent) => {
3737
event.preventDefault();
@@ -46,44 +46,59 @@ export const FooterNewsletterForm = ({
4646
};
4747

4848
return (
49-
<div>
50-
<form onSubmit={handleSubmit}>
51-
<label htmlFor="MERGE0" aria-label="Email">
52-
{icon("fa-light fa-envelope")}
53-
<Input
54-
type="email"
55-
name="EMAIL"
56-
id="MERGE0"
57-
value={email}
58-
placeholder="Email Address"
59-
onChange={(e) => setEmail(e.target.value)}
60-
autoCapitalize="off"
61-
autoCorrect="off"
62-
disabled={isSubmitting || isSubmitted || isAlreadySubscribed}
63-
/>
64-
</label>
65-
<Button
66-
variant="ppg"
67-
disabled={isSubmitting || isSubmitted || isAlreadySubscribed}
68-
>
69-
<input
70-
type="submit"
71-
value={getButtonText()}
72-
name="subscribe"
73-
id="mc-embedded-subscribe"
74-
/>
75-
</Button>
76-
{error && <p className="text-red-500 text-sm mt-2">{error}</p>}
77-
{isSubmitted && (
78-
<p className="text-green-500 text-sm mt-2">
79-
Please check your email to confirm your subscription!
80-
</p>
81-
)}
82-
{isAlreadySubscribed && (
83-
<p className="text-blue-500 text-sm mt-2">
84-
You're already subscribed to our newsletter!
85-
</p>
86-
)}
49+
<div className="w-full">
50+
<form
51+
onSubmit={handleSubmit}
52+
className="flex gap-6 sm:gap-2 items-center justify-between w-full flex-col sm:flex-row "
53+
>
54+
<h5 className="font-family-display font-[650] text-white text-base">
55+
Subscribe to our newsletter
56+
</h5>
57+
<div>
58+
<div className="flex gap-2 items-center w-full sm:w-auto">
59+
<label htmlFor="MERGE0" aria-label="Email" className="flex-grow">
60+
<Input
61+
type="email"
62+
name="EMAIL"
63+
id="MERGE0"
64+
size="2xl"
65+
value={email}
66+
placeholder="Your email..."
67+
onChange={(e) => setEmail(e.target.value)}
68+
autoCapitalize="off"
69+
autoCorrect="off"
70+
disabled={isSubmitting || isSubmitted || isAlreadySubscribed}
71+
/>
72+
</label>
73+
<Button
74+
variant="ppg"
75+
size="xl"
76+
disabled={isSubmitting || isSubmitted || isAlreadySubscribed}
77+
>
78+
<input
79+
type="submit"
80+
value={getButtonText()}
81+
name="subscribe"
82+
id="mc-embedded-subscribe"
83+
/>
84+
</Button>
85+
</div>
86+
{error && (
87+
<p className="text-red-500 text-sm mt-2 self-start sm:absolute">
88+
{error}
89+
</p>
90+
)}
91+
{isSubmitted && (
92+
<p className="text-green-500 text-sm mt-2 self-start sm:absolute">
93+
Please check your email to confirm your subscription!
94+
</p>
95+
)}
96+
{isAlreadySubscribed && (
97+
<p className="text-blue-500 text-sm mt-2 self-start sm:absolute">
98+
You're already subscribed to our newsletter!
99+
</p>
100+
)}
101+
</div>
87102
</form>
88103
</div>
89104
);

0 commit comments

Comments
 (0)