Skip to content

Commit 86c23d5

Browse files
authored
Merge pull request #642 from joecan/master
Make elm-lang.org responsive
2 parents daababa + a1221a0 commit 86c23d5

16 files changed

+137
-124
lines changed

assets/style.css

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ a:hover {
3636
margin-bottom: 6px;
3737
}
3838

39+
.content img {
40+
width: 100%;
41+
height: 100%;
42+
}
43+
3944

4045
/* home stuff */
4146

@@ -86,23 +91,23 @@ a:hover {
8691
margin: 0 auto;
8792
}
8893
.feature-image {
89-
width: 420px;
94+
max-width: 420px;
9095
display: block;
9196
margin: 0 auto;
9297
}
9398
}
9499

95100
@media (min-width: 820px) {
96101
.features {
97-
width: 800px;
102+
max-width: 800px;
98103
}
99104
.feature {
100105
position: relative;
101106
margin-top: 1em;
102107
margin-bottom: 4em;
103108
}
104109
.feature-description {
105-
width: 340px;
110+
max-width: 340px;
106111
}
107112
.feature-image {
108113
position: absolute;
@@ -130,6 +135,7 @@ a:hover {
130135

131136
/* top bar */
132137

138+
133139
#tabs {
134140
padding: 1em;
135141
background-color: #60B5CC;
@@ -161,6 +167,17 @@ a:hover {
161167
border-bottom: 3px solid #34495E;
162168
}
163169

170+
@media (max-width: 600px) {
171+
.tab {
172+
font-size: 15px;
173+
margin: 0 0.5em;
174+
}
175+
.content {
176+
margin: 0 0.5em !important;
177+
}
178+
}
179+
180+
164181

165182
/* splash */
166183

@@ -212,15 +229,21 @@ Not really any of those on the website though AFAIK.
212229
content: "\00a0";
213230
}
214231

232+
pre > code {
233+
display: block;
234+
overflow-x: auto;
235+
}
236+
215237

216238
/* blogs */
217239

218240
.author {
219241
padding-top: 1em;
220242
color: #ddd;
221243
display: block;
222-
width: 600px;
244+
max-width: 600px;
223245
margin: 0 auto;
246+
padding-right: 10px;
224247
text-align: right;
225248
}
226249

@@ -305,3 +328,20 @@ blockquote p {
305328
color: #bbbbbb;
306329
}
307330

331+
/* iframes */
332+
333+
.intrinsic-container {
334+
position: relative;
335+
height: 0;
336+
overflow: hidden;
337+
padding-bottom: 56.25%; /*assuming 16/9 aspect ratio*/
338+
max-width: 800px;
339+
}
340+
341+
.intrinsic-container iframe {
342+
position: absolute;
343+
top:0;
344+
left: 0;
345+
width: 100%;
346+
height: 100%;
347+
}

src/backend/Generate.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ htmlSkeleton analytics highlight title scripts =
6464
H.docTypeHtml $ do
6565
H.head $ do
6666
H.meta ! A.charset "UTF-8"
67+
H.meta ! A.name "viewport" ! A.content "width=device-width, initial-scale=1"
6768
H.title (H.toHtml title)
6869
favicon
6970
H.link ! A.rel "stylesheet" ! A.href "/assets/style.css?v=3"
@@ -90,7 +91,7 @@ favicon :: H.Html
9091
favicon =
9192
H.link
9293
! A.rel "shortcut icon"
93-
! A.size "16x16, 32x32, 48x48, 64x64, 128x128, 256x256"
94+
! A.sizes "16x16 32x32 48x48 64x64 128x128 256x256"
9495
! A.href "/favicon.ico"
9596

9697

src/pages/blog/announce/0.12.3.elm

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ We of course need to start with an example. As you move your mouse within the
4141
grey box, [Thwomp](http://www.mariowiki.com/Thwomp#Super_Mario_64) will stare
4242
at you. Too far away to crush you, but waiting...
4343
44-
<iframe src="/examples/thwomp"
45-
frameborder="0"
46-
width="600"
47-
height="300"
48-
style="background-color: #D8DDE1;">
49-
</iframe>
44+
<div class="intrinsic-container">
45+
<iframe src="/examples/thwomp"
46+
style="background-color: #D8DDE1;">
47+
</iframe>
48+
</div>
5049
5150
Typically, working with WebGL in JS means wrestling with a huge 90s era C++ API
5251
with a great deal of [incidental

src/pages/blog/announce/0.7.1.elm

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ powerful than you really need.
7070
These signals came in handy when creating a turtle that swims around and surfaces,
7171
based on the `arrows` and `space` signals.
7272
73-
<iframe
74-
width="480" height="270"
75-
src="https://www.youtube.com/embed/Xshzzzbw3KY?rel=0;showinfo=0"
76-
frameborder="0"
77-
allowfullscreen
78-
style="margin:0px auto; display:block;"></iframe>
73+
<div class="intrinsic-container">
74+
<iframe
75+
src="https://www.youtube.com/embed/Xshzzzbw3KY?rel=0;showinfo=0"
76+
allowfullscreen></iframe>
77+
</div>
7978
8079
This takes only 20 physical lines of code, which you can see and modify
8180
in the interactive editor [here][src].
@@ -234,4 +233,3 @@ Thanks to Grzegorz and Mads for working on cool projects! Again, I encourage you
234233
[set up Preselm](https://github.com/grzegorzbalcerek/Preselm#preselm) or
235234
[try out the inline docs](https://groups.google.com/forum/?fromgroups=#!topic/elm-discuss/_xmbeVfjYbI)!
236235
"""
237-

src/pages/blog/announce/0.8.elm

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,8 @@ explains all of the details of the API.
7373
7474
The following video is a short demo of how to embed Elm in a `<div>`.
7575
76-
<div style="position:relative; height:350px;">
77-
<iframe width="600" height="350"
78-
src="http://www.youtube.com/embed/xt07tLqa_m8?rel=0"
79-
style="position:absolute; margin-left:-300px; left:50%;"
80-
frameborder="0" allowfullscreen></iframe>
76+
<div class="intrinsic-container">
77+
<iframe src="http://www.youtube.com/embed/xt07tLqa_m8?rel=0" allowfullscreen></iframe>
8178
</div>
8279
8380
So it is no longer an all-or-nothing choice. You can use Elm where it

src/pages/blog/blazing-fast-html-round-two.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ main =
3131

3232

3333
image name =
34-
div [ Center.style "800px" ]
34+
div [ Center.style "800px", class "content" ]
3535
[ a
3636
[ href "https://evancz.github.io/react-angular-ember-elm-performance-comparison/"
3737
, title "Run the benchmarks yourself!"
@@ -370,4 +370,4 @@ you, and I learned a bunch from how you did things! I also want to thank
370370
[Sergey]: https://github.com/IwalkAlone
371371
[Stephen]: https://github.com/stephencelis
372372
373-
"""
373+
"""

src/pages/blog/blazing-fast-html.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ popular entries:
3636
<a href="https://evancz.github.io/todomvc-perf-comparison">
3737
<img src="/diagrams/sampleResults.png"
3838
alt="sample results with Firefox 30 on a Macbook Air with OSX 10.9.4"
39-
title="sample results with Firefox 30 on a Macbook Air with OSX 10.9.4"
40-
style="width:500px; height:380px; margin-left: auto; margin-right: auto; display:block;"></a>
39+
title="sample results with Firefox 30 on a Macbook Air with OSX 10.9.4"z
40+
style="max-width: 500px; margin-left: auto; margin-right: auto; display:block;"></a>
4141
4242
Both [elm-html][] and Mercury are based on the [virtual-dom][] project, which is
4343
responsible for the great performance. The first half of this post will explore

src/pages/blog/compiler-errors-for-humans.elm

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ main =
2222

2323

2424
image url =
25-
img
26-
[ src url
27-
, style [("display", "block"), ("margin", "1em auto")]
28-
, alt "compiler output example"
29-
]
30-
[]
25+
div [class "content", Center.style "900px"] [
26+
img
27+
[ src url
28+
, style [("display", "block"), ("margin", "1em auto")]
29+
, alt "compiler output example"
30+
]
31+
[]
32+
]
3133

3234

3335
content = """
@@ -186,15 +188,11 @@ his [elm-vim][] plugin:
186188
187189
[elm-vim]: https://github.com/ajhager/elm-vim
188190
191+
<div class="intrinsic-container">
189192
<iframe
190193
src="https://player.vimeo.com/video/132107269?color=49c180&title=0&byline=0&portrait=0"
191-
width="500"
192-
height="281"
193-
frameborder="0"
194-
style="padding: 0 50px;"
195-
webkitallowfullscreen
196-
mozallowfullscreen
197194
allowfullscreen></iframe>
195+
</div>
198196
199197
(This is really exciting, great job!)
200198

src/pages/blog/compilers-as-assistants.elm

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ main =
1212
Blog.evan
1313
(Blog.Date 2015 11 19)
1414
[ Center.markdown "600px" content
15-
, iframe
16-
[ width 560
17-
, height 315
18-
, src "https://www.youtube.com/embed/ARJ8cAGm6JE?start=60&end=87&rel=0&autoplay=0"
19-
, attribute "frameborder" "0"
20-
, attribute "allowfullscreen" ""
21-
, style
22-
[ "display" => "block"
23-
, "margin" => "1em auto"
24-
]
25-
]
26-
[]
15+
, div [Center.style "600px"]
16+
[div [ class "intrinsic-container" ]
17+
[ iframe
18+
[ src "https://www.youtube.com/embed/ARJ8cAGm6JE?start=60&end=87&rel=0&autoplay=0"
19+
, attribute "allowfullscreen" ""
20+
] []
21+
]
22+
]
2723
, Center.markdown "600px" afterVideo
2824
, image "big-record"
2925
, Center.markdown "600px" afterTypeDiffs
@@ -47,13 +43,14 @@ main =
4743

4844

4945
image name =
50-
img
51-
[ src ("/assets/blog/error-messages/0.16/" ++ name ++ ".png")
52-
, style [("display", "block"), ("margin", "1em auto")]
53-
, alt "compiler output example"
46+
div [class "content", Center.style "600px"] [
47+
img
48+
[ src ("/assets/blog/error-messages/0.16/" ++ name ++ ".png")
49+
, style [("display", "block"), ("margin", "1em auto")]
50+
, alt "compiler output example"
51+
]
52+
[]
5453
]
55-
[]
56-
5754

5855
content = """
5956

src/pages/blog/farewell-to-frp.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ main =
3030
, iframe
3131
[ style
3232
[ "display" => "block"
33-
, "width" => "400px"
33+
, "width" => "300px"
3434
, "height" => "200px"
3535
, "padding" => "20px"
3636
, "margin" => "0 auto"

0 commit comments

Comments
 (0)