Skip to content

Commit 616ab69

Browse files
authored
Style Email Signup Form (#1541)
1 parent 15f7592 commit 616ab69

File tree

3 files changed

+86
-16
lines changed

3 files changed

+86
-16
lines changed

sass/_extra.scss

+55-8
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,46 @@ h6:hover .anchor {
9999
margin-bottom: 0;
100100
}
101101

102+
input, button {
103+
font-size: inherit;
104+
}
105+
106+
input {
107+
min-width: 0; // Allow the input to shrink on small devices.
108+
}
109+
110+
a.btn, // Trick to increase the specificity and win against rules such as a:visited
102111
.btn {
103112
text-decoration: none;
104113
border-radius: 3px;
105114
font-weight: 600;
106-
border: 1px solid transparent;
115+
border: none;
107116
box-sizing: border-box;
108117
display: inline-block;
109118
padding: 0.4em 2em;
119+
transition: background-color 125ms;
110120

111121
background-color: $brand-color;
112122
color: $background-color;
113123
border-color: $background-color;
114124

115125
&:hover {
116126
color: lighten($background-color, 10);
117-
border-color: $brand-color;
127+
background-color: lighten($brand-color, 5);
128+
}
129+
130+
&:active {
131+
background-color: darken($brand-color, 5);
118132
}
119133
}
120134

135+
input[type=email] {
136+
border-radius: 3px;
137+
border: 1px solid $brand-color;
138+
box-sizing: border-box;
139+
padding: .4em;
140+
}
141+
121142
// A hack for image captions.
122143
// See https://stackoverflow.com/questions/19331362/using-an-image-caption-in-markdown-jekyll
123144
img+em,
@@ -129,13 +150,39 @@ video+em {
129150
}
130151

131152
.email-form {
132-
display: flex;
153+
display: grid;
154+
margin-top: $spacing-unit;
155+
grid-template-columns: auto auto;
156+
justify-content: center;
157+
gap: .6em 1em;
158+
background-color: color-mix(in oklab, $brand-color 20%, #fff);
159+
padding: $spacing-unit * .5;
160+
align-items: center;
161+
border-radius: 3px;
162+
163+
.email-form__icon {
164+
width: 5em;
165+
height: 5em;
166+
--icon-stroke-color: #{$brand-color};
167+
--icon-fill-color: rgba(255, 255, 255, .4);
168+
}
133169

134-
.email-input {
135-
margin-right: 0px;
170+
.email-form__description {
171+
max-width: 18em;
136172
}
137173

138-
.email-submit {
139-
margin-left: 0px;
174+
.email-form__input {
175+
grid-column: 1 / 3;
140176
}
141-
}
177+
}
178+
179+
.email-input {
180+
display: grid;
181+
grid-template-columns: repeat(2, auto);
182+
gap: 5px;
183+
184+
label {
185+
grid-column: 1 / 3;
186+
font-size: .8em;
187+
}
188+
}

static/intro-icons.svg

+17-1
Loading

templates/includes/email_signup.html

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
<form action="https://gamedev.us22.list-manage.com/subscribe/post?u=3b2317bf9350c11e252162541&amp;id=aaf37783ec&amp;f_id=0011cde1f0" method="post" name="mc-embedded-subscribe-form">
22
<div class="email-form">
3-
<div class="email-input">
4-
<label for="email-input">Email Address</label>
5-
<input type="email" inputmode="email" name="EMAIL" id="email-input" required>
3+
<svg class="email-form__icon" aria-hidden="true">
4+
<svg><use xlink:href="{{ get_url(path='intro-icons.svg#incoming-envelope') }}"></use></svg>
5+
</svg>
6+
7+
<div class="email-form__description">
8+
Get the Rust GameDev Workgroup’s monthly newsletter delivered directly to your inbox.
69
</div>
7-
<div class="email-submit">
10+
11+
<div class="email-form__input email-input">
12+
<label for="email-input">Email Address</label>
13+
<input type="email" inputmode="email" name="EMAIL" id="email-input" placeholder="[email protected]" required>
814
<button type="submit" name="subscribe" class="btn">Subscribe</button>
9-
</div>
10-
<div style="position: absolute; left: -5000px;" aria-hidden="true">
11-
<input type="text" name="b_3b2317bf9350c11e252162541_aaf37783ec" tabindex="-1" value="">
15+
16+
<div style="position: absolute; left: -5000px;" aria-hidden="true">
17+
<input type="text" name="b_3b2317bf9350c11e252162541_aaf37783ec" tabindex="-1" value="">
18+
</div>
1219
</div>
1320
</div>
1421
</form>

0 commit comments

Comments
 (0)