Skip to content

Commit 60f2f02

Browse files
committed
Lots of CSS improvs
1 parent 017d72f commit 60f2f02

File tree

2 files changed

+114
-17
lines changed

2 files changed

+114
-17
lines changed

src/Giraffe.Website/Assets/Private/main.css

Lines changed: 96 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
body {
22
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
33
color: #333;
4+
-ms-word-wrap: break-word;
5+
word-wrap: break-word;
6+
font-size: 1.1em;
47
}
58

69
header, main, nav, footer {
@@ -13,23 +16,52 @@ main {
1316
margin: 2em auto;
1417
}
1518

16-
/*code {*/
17-
/* background: #333;*/
18-
/* color: #f1f1f1;*/
19-
/*}*/
19+
/*Fixing monospace handling across browsers*/
20+
pre,
21+
code,
22+
kbd,
23+
samp {
24+
font-family: monospace, monospace;
25+
font-size: 1em;
26+
}
27+
28+
code{
29+
display: inline-block;
30+
padding: .1em .4em;
31+
-ms-border-radius: 4px;
32+
border-radius: 4px;
33+
font-family: 'Roboto Mono', Menlo, Consolas, "Courier New", monospace;
34+
font-size: .8em;
35+
line-height: 1.5em;
36+
text-align: left;
37+
white-space: pre-wrap;
38+
word-wrap: break-word;
39+
background-color: #e1e1e1;
40+
color: #cd5c5c;
41+
}
2042

2143
pre {
44+
width: auto;
45+
overflow-x: auto;
2246
display: block;
2347
padding: .5em 1em;
2448
border-radius: 3px;
25-
font-family: Menlo, Consolas, "Courier New", monospace;
49+
font-family: 'Roboto Mono', Menlo, Consolas, "Courier New", monospace;
2650
line-height: 1.2em;
2751
background: #444;
2852
color: #fff;
2953
}
3054

55+
pre > code {
56+
display: block;
57+
padding: .2em 0 .2em .5em;
58+
font-size: .75em;
59+
background: #444;
60+
color: #fff;
61+
}
62+
3163
p {
32-
line-height: 1.4em;
64+
line-height: 1.5em;
3365
}
3466

3567
h1 {
@@ -38,6 +70,7 @@ h1 {
3870

3971
h2 {
4072
font-size: 2.4em;
73+
color: #603504;
4174
}
4275

4376
h3 {
@@ -58,12 +91,29 @@ h6 {
5891
font-weight: bold;
5992
}
6093

94+
a {
95+
text-decoration: none;
96+
color: #ba6a02;
97+
}
98+
99+
a:hover {
100+
text-decoration: none;
101+
color: #ffbb02;
102+
}
103+
104+
ul li {
105+
margin: .6em 0;
106+
}
107+
108+
ul li a {
109+
color: #603504;
110+
}
111+
61112
nav {
62113
display: flex;
63114
justify-content: space-around;
64115
padding: 0;
65-
border-top: 1px solid #e1e1e1;
66-
border-bottom: 1px solid #e1e1e1;
116+
text-align: center;
67117
}
68118

69119
nav ul {
@@ -74,22 +124,54 @@ nav ul {
74124

75125
nav ul li {
76126
display: inline-block;
77-
margin: .5em;
127+
margin: .7em;
78128
}
79129

80-
a {
81-
text-decoration: none;
82-
color: #87281b;
130+
nav a {
131+
font-size: .8em;
132+
padding-bottom: 3px;
133+
border-bottom: 3px solid #fcc72b;
134+
text-transform: uppercase;
135+
color: #825e34 !important;
83136
}
84137

85-
a:hover {
86-
text-decoration: underline;
138+
nav a:hover {
139+
text-decoration: none;
140+
color: #ffbb02 !important;
87141
}
88142

89143
footer {
90144
font-size: .8em;
91145
}
92146

147+
table {
148+
display: block;
149+
width: 100%;
150+
box-sizing: border-box;
151+
border: 1px solid #efefef;
152+
border-radius: 3px;
153+
-moz-border-radius: 3px;
154+
padding: 5px;
155+
}
156+
157+
tbody, thead, tr {
158+
width: 100%;
159+
box-sizing: border-box;
160+
}
161+
162+
td, th {
163+
text-align: left;
164+
font-size: .95em;
165+
padding: .5em;
166+
}
167+
168+
td code {
169+
background: transparent;
170+
}
171+
172+
tr:nth-child(odd) { background-color: #fff; }
173+
tr:nth-child(even) { background-color: #f1f1f1; }
174+
93175
#inner-footer {
94176
border-top: 1px solid #e1e1e1;
95177
text-align: center;

src/Giraffe.Website/Program.fs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ module Views =
156156
li [] [ internalLink "/" "Home" ]
157157
li [] [ internalLink "/docs" "Documentation" ]
158158
li [] [ internalLink "/view-engine" "View Engine" ]
159-
li [] [ externalLink "https://github.com/giraffe-fsharp/giraffe" "GitHub"]
159+
li [] [ externalLink "https://github.com/giraffe-fsharp" "GitHub"]
160160
li [] [ externalLink "https://github.com/giraffe-fsharp/Giraffe/releases" "Releases" ]
161161
]
162162
]
@@ -188,6 +188,7 @@ module MarkDog =
188188
let private pipeline =
189189
MarkdownPipelineBuilder()
190190
.UseAutoIdentifiers(AutoIdentifierOptions.GitHub)
191+
.UsePipeTables()
191192
.Build()
192193

193194
let toHtml (value : string) =
@@ -222,13 +223,17 @@ module WebApp =
222223
(markdownUrl : string)
223224
(title : string)
224225
(permalink : string)
225-
(lineStart : int) : HttpHandler =
226+
(lineStart : int)
227+
(linkReplacements : Map<string, string>) : HttpHandler =
226228
fun next ctx ->
227229
task {
228230
let client = new HttpClient()
229231
let! allContent = client.GetStringAsync(markdownUrl)
230232
let content =
231-
allContent.Split([| Environment.NewLine |], StringSplitOptions.None)
233+
linkReplacements
234+
|> (Map.fold(fun (c : string) key sub -> c.Replace(key, sub)) allContent)
235+
|> fun c -> c.Replace(markdownUrl, permalink)
236+
|> fun c -> c.Split([| Environment.NewLine |], StringSplitOptions.None)
232237
|> Array.skip lineStart
233238
|> String.concat Environment.NewLine
234239
let response =
@@ -240,13 +245,21 @@ module WebApp =
240245
return! response next ctx
241246
}
242247

248+
let linkReplacements =
249+
[
250+
"https://github.com/giraffe-fsharp/Giraffe/blob/master/README.md", (Url.create "/")
251+
"https://github.com/giraffe-fsharp/Giraffe/blob/master/DOCUMENTATION.md", (Url.create "/docs")
252+
"https://github.com/giraffe-fsharp/Giraffe.ViewEngine/blob/master/README.md", (Url.create "/view-engine")
253+
] |> Map.ofList
254+
243255
let private indexHandler =
244256
allowCaching (TimeSpan.FromDays(1.0)) >=>
245257
markdownHandler
246258
"https://raw.githubusercontent.com/giraffe-fsharp/Giraffe/master/README.md"
247259
"Home"
248260
(Url.create "/")
249261
4
262+
linkReplacements
250263

251264
let private docsHandler =
252265
allowCaching (TimeSpan.FromDays(1.0)) >=>
@@ -255,6 +268,7 @@ module WebApp =
255268
"Documentation"
256269
(Url.create "/docs")
257270
0
271+
linkReplacements
258272

259273
let private viewEngineHandler =
260274
allowCaching (TimeSpan.FromDays(1.0)) >=>
@@ -263,6 +277,7 @@ module WebApp =
263277
"View Engine"
264278
(Url.create "/view-engine")
265279
2
280+
linkReplacements
266281

267282
let private pingPongHandler : HttpHandler =
268283
noResponseCaching >=> text "pong"

0 commit comments

Comments
 (0)