Skip to content

Commit 8b86f32

Browse files
committed
clean up mult-6 logic
1 parent b1058b4 commit 8b86f32

File tree

9 files changed

+93
-24
lines changed

9 files changed

+93
-24
lines changed

.eslintrc

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
{
2-
"extends": "airbnb"
2+
"plugins": [
3+
"es5"
4+
],
5+
"env": {
6+
"browser": true
7+
}
38
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"del": "^3.0.0",
1313
"eslint": "^6.8.0",
1414
"eslint-config-airbnb": "17.1.0",
15+
"eslint-plugin-es5": "^1.5.0",
1516
"eslint-plugin-import": "^2.20.1",
1617
"eslint-plugin-jsx-a11y": "^6.2.3",
1718
"eslint-plugin-react": "^7.19.0",

src/img/tractor.jpg

105 KB
Loading

src/js/mult6.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
// todo: on resize make everything always a multiple of 6rem;
1+
document.addEventListener('DOMContentLoaded', function () {
2+
var textElems = document.getElementsByClassName('stretch-to-mult');
3+
4+
function stretchAsNeeded() {
5+
var i, naturalHeight, remainder;
6+
var rem = parseFloat(window.getComputedStyle(document.body).fontSize);
7+
for (i = 0; i < textElems.length; i++) {
8+
textElems[i].style.height = 'auto';
9+
naturalHeight = parseFloat(window.getComputedStyle(textElems[i]).height);
10+
remainder = naturalHeight % (6 * rem);
11+
if (remainder !== 0) {
12+
textElems[i].style.height = (naturalHeight + (6 * rem) - remainder) + "px";
13+
}
14+
}
15+
}
16+
17+
window.addEventListener('resize', stretchAsNeeded);
18+
stretchAsNeeded();
19+
});

src/sass/_agtech.scss

+35-14
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
}
1010

1111
.text-content {
12-
padding: 3rem 0;
13-
12+
padding: 1.5rem 0;
13+
display: flex;
14+
flex-direction: column;
15+
justify-content: center;
1416

1517
p {
1618
margin-bottom: 1.5rem;
@@ -83,13 +85,12 @@ header {
8385

8486
.team-list {
8587
margin: 0 -3rem;
86-
padding: 3rem 0;
88+
padding: 3rem 0 0;
8789
position: relative;
8890
z-index: 2;
8991

9092
.team-member {
9193
display: flex;
92-
margin-bottom: 6rem;
9394
// min-height: 18rem;
9495

9596
h3 {
@@ -104,7 +105,7 @@ header {
104105
}
105106

106107
.text {
107-
padding: 0 3rem;
108+
padding: 0 3rem 6rem;
108109
}
109110

110111
&:nth-child(odd) {
@@ -139,19 +140,16 @@ header {
139140
}
140141
}
141142

142-
footer {
143+
.footer {
143144
text-align: center;
145+
144146
.content-block {
145147
padding-bottom: 3rem;
146148
}
147149
}
148150

149151
@media screen and (max-width: 76rem) {
150152
.art-block {
151-
img.horizontal {
152-
left: 0;
153-
}
154-
155153
&.green-strip {
156154
width: 12rem;
157155
}
@@ -160,13 +158,17 @@ footer {
160158

161159
@media screen and (max-width: 64rem) {
162160
.art-block {
161+
img.horizontal {
162+
left: 0;
163+
}
164+
163165
&.green-strip {
164166
width: 6rem;
165167
}
166168
}
167169
}
168170

169-
@media screen and (max-width: 52rem) {
171+
@media screen and (max-width: 58rem) {
170172
header {
171173
min-height: 0;
172174

@@ -188,12 +190,31 @@ footer {
188190

189191
.art-block {
190192
display: block;
193+
overflow: hidden;
191194

192195
img {
193-
display: none;
196+
&.horizontal {
197+
right: 18rem;
198+
transform: translateX(100%);
199+
top: 0;
200+
bottom: auto;
201+
left: auto;
202+
height: 12rem;
203+
}
204+
205+
&.vertical {
206+
left: 6rem;
207+
width:12rem;
208+
}
209+
}
210+
211+
&.blue {
212+
height: 18rem;
213+
width: 100%;
214+
min-height: 0;
194215
}
195216

196-
&.blue, &.hero {
217+
&.hero {
197218
height: 12rem;
198219
width: 100%;
199220
min-height: 0;
@@ -215,7 +236,7 @@ footer {
215236
margin-left: -12rem;
216237

217238
.text {
218-
padding: 0 1.5rem;
239+
padding: 0 1.5rem 3rem;
219240
}
220241

221242
&:nth-child(even), &:nth-child(odd) {

src/sass/_layout.scss

+16-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ $content-width: 72rem;
1010
section {
1111
display: flex;
1212
margin: 0 auto 6rem;
13+
max-width: 144rem;
14+
}
15+
16+
@media screen and (max-width: 136rem) {
17+
section {
18+
max-width: 132rem;
19+
}
1320
}
1421

1522
@media screen and (max-width: 124rem) {
@@ -48,16 +55,23 @@ section {
4855
}
4956
}
5057

51-
@media screen and (max-width: 52rem) {
58+
@media screen and (max-width: 58rem) {
5259
section {
53-
max-width: 48rem;
60+
max-width: 54rem;
61+
margin: 0 auto 3rem;
5462

5563
&.two-up {
5664
display: block;
5765
}
5866
}
5967
}
6068

69+
@media screen and (max-width: 52rem) {
70+
section {
71+
max-width: 48rem;
72+
}
73+
}
74+
6175
@media screen and (max-width: 46rem) {
6276
section {
6377
max-width: 42rem;

src/sass/_typography.scss

+5-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ strong {
8888
}
8989

9090
h2, %h2 {
91-
font-size: 1.5rem;
91+
font-size: 2.5rem;
9292
}
9393
}
9494

@@ -100,4 +100,8 @@ strong {
100100
h2, %h2 {
101101
font-size: 2rem;
102102
}
103+
104+
h3, %h3 {
105+
font-size: 1.5rem;
106+
}
103107
}

src/templates/agtech/index.hbs

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
</header>
2121
</div>
2222
<div class="art-block grow hero">
23-
<img class="horizontal" src="/img/farmland.jpg" alt="farmland">
23+
<img class="horizontal" src="/img/tractor.jpg" alt="farmland">
2424
</div>
2525
</section>
2626
<section class="two-up">
2727
<div class="art-block grow blue">
2828
<img class="vertical" src="/img/crops.jpg" alt="farmland">
2929
</div>
3030
<div class="content-block">
31-
<div class="text-content">
31+
<div class="text-content stretch-to-mult">
3232
<p>Research grant funded by <a href="https://joininteract.com">Interact</a>, a nonprofit fellowship. We respect each other’s time, skillsets, and perspectives. We are open with ourselves and others about how we are doing. We care about the impact we have on each other and on the world. We both meet people where they are, and push them to do their best.</p>
3333
<p>Research grant funded by <a href="https://joininteract.com">Interact</a>, a nonprofit fellowship. We respect each other’s time, skillsets, and perspectives. We are open with ourselves and others about how we are doing. We care about the impact we have on each other and on the world. We both meet people where they are, and push them to do their best.</p>
3434
</div>
@@ -44,7 +44,7 @@
4444
<div class="image-wrapper">
4545
<img src="{{ this.profile }}" />
4646
</div>
47-
<div class="text">
47+
<div class="text stretch-to-mult">
4848
<h3>{{ this.name }}</h3>
4949
<p>{{ this.bio }}</p>
5050
</div>
@@ -54,12 +54,13 @@
5454
</div>
5555
<div class="art-block green-strip"></div>
5656
</section>
57-
<footer>
57+
<section class="footer">
5858
<div class="content-block">
5959
<h2>Get in touch</h2>
6060
<a class="button" href="mailto:[email protected]">[email protected]</a>
6161
<p>&copy; 2020 Interact</p>
6262
</div>
63-
</footer>
63+
</section>
64+
<script src="/js/mult6.js"></script>
6465
{{/content}}
6566
{{/extend}}

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,11 @@ eslint-module-utils@^2.6.0:
23382338
debug "^2.6.9"
23392339
pkg-dir "^2.0.0"
23402340

2341+
eslint-plugin-es5@^1.5.0:
2342+
version "1.5.0"
2343+
resolved "https://registry.yarnpkg.com/eslint-plugin-es5/-/eslint-plugin-es5-1.5.0.tgz#aab19af3d4798f7924bba309bc4f87087280fbba"
2344+
integrity sha512-Qxmfo7v2B7SGAEURJo0dpBweFf+JU15kSyALfiB2rXWcBuJ96r6X9kFHXFnhdopPHCaHjoQs1xQPUJVbGMb1AA==
2345+
23412346
eslint-plugin-import@^2.20.1:
23422347
version "2.22.0"
23432348
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.0.tgz#92f7736fe1fde3e2de77623c838dd992ff5ffb7e"

0 commit comments

Comments
 (0)