Skip to content

Commit dd3bfc3

Browse files
authored
Merge pull request #21 from pikinier20/scaladoc/code-snippet-style
Code snippet style
2 parents a019b61 + 6141dfc commit dd3bfc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1744
-1455
lines changed

docs/_assets/css/color-brewer.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Ported by Fabrício Tavares de Oliveira
66
77
*/
88

9-
.hljs {
9+
/* .hljs {
1010
background: transparent;
1111
}
1212
1313
.hljs,
1414
.hljs-subst {
1515
color: #000;
16-
}
16+
} */
1717

1818
/*.hljs-string,
1919
.hljs-meta,
@@ -24,7 +24,7 @@ Ported by Fabrício Tavares de Oliveira
2424
color: #756bb1;
2525
}*/
2626

27-
.hljs-comment,
27+
/* .hljs-comment,
2828
.hljs-quote {
2929
color: #636363;
3030
}
@@ -40,7 +40,7 @@ Ported by Fabrício Tavares de Oliveira
4040
.hljs-deletion,
4141
.hljs-variable {
4242
color: #88f;
43-
}
43+
} */
4444

4545
/*.hljs-keyword,
4646
.hljs-selector-tag,
@@ -57,10 +57,10 @@ Ported by Fabrício Tavares de Oliveira
5757
color: #3182bd;
5858
}*/
5959

60-
.hljs-emphasis {
60+
/* .hljs-emphasis {
6161
font-style: italic;
6262
}
6363
6464
.hljs-attribute {
6565
color: #e6550d;
66-
}
66+
} */

docs/_layouts/main.html

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,4 @@
66
- css/content-contributors.css
77
---
88

9-
<div id="content-wrapper">
10-
{{ content }}
11-
<div id="footer" class="body-small mobile-footer">
12-
<div class="left-container">"Generated with"</div>
13-
<div class="right-container">
14-
<a href="https://github.com/lampepfl/dotty">
15-
<button class="icon-button gh"></button>
16-
</a>
17-
<a href="https://twitter.com/scala_lang">
18-
<button class="icon-button twitter"></button>
19-
</a>
20-
<a href="https://discord.com/invite/scala">
21-
<button class="icon-button discord"></button>
22-
</a>
23-
<a href="https://gitter.im/scala/scala">
24-
<button class="icon-button gitter"></button>
25-
</a>
26-
<div class="text">"© 2002-2021 · LAMP/EPFL"</div>
27-
</div>
28-
<div cls="text-mobile"></div>
29-
"© 2002-2021 · LAMP/EPFL"
30-
</div>
31-
</div>
9+
<div id="content-wrapper">{{ content }}</div>

scaladoc-js/common/css/code-snippets.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* Snippets */
22

3-
.snippet {
3+
/* .snippet {
44
position: relative;
55
background: var(--code-bg);
66
margin: 1em 0px;
77
border-radius: 2px;
88
box-shadow: 0 0 2px #888;
99
cursor: default;
10-
}
11-
.snippet-error {
10+
} */
11+
/* .snippet-error {
1212
border-bottom: 2px dotted red;
1313
}
1414
.snippet-warn {
@@ -19,17 +19,17 @@
1919
}
2020
.snippet-debug {
2121
border-bottom: 2px dotted pink;
22-
}
22+
} */
2323

24-
.snippet .snippet-meta {
24+
/* .snippet .snippet-meta {
2525
border-top: 2px solid var(--inactive-bg);
2626
color: var(--inactive-fg);
2727
margin-top: 10px;
2828
padding-top: 10px;
2929
font-size: 0.75em;
30-
}
30+
} */
3131

32-
.snippet-meta .snippet-label {
32+
/* .snippet-meta .snippet-label {
3333
font-weight: bold;
3434
}
3535
@@ -319,4 +319,4 @@ input:checked + .slider:before {
319319
--slider-width: 24px;
320320
--slider-height: 10px;
321321
}
322-
}
322+
} */

scaladoc-js/common/src/code-snippets/CodeSnippets.scala

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import scala.util.chaining._
99

1010
import CodeSnippetsGlobals._
1111

12+
1213
class CodeSnippets:
1314
lazy val scastieConfig = getScastieConfiguration
1415

@@ -38,12 +39,10 @@ class CodeSnippets:
3839
case _ =>
3940
}
4041
def createShowHideButton(toggleRoot: html.Element) = {
41-
div(cls := "snippet-showhide")(
42+
div(cls := "snippet-showhide-container")(
4243
label(cls := "snippet-showhide-button")(
43-
input("type" := "checkbox").tap(_.addEventListener("change", _ => toggleHide(toggleRoot))),
44-
span(cls := "slider")
44+
input("type" := "checkbox", cls := "snippet-showhide").tap(_.addEventListener("change", _ => toggleHide(toggleRoot))),
4545
),
46-
p("Show collapsed lines")
4746
)
4847
}
4948

@@ -88,11 +87,14 @@ class CodeSnippets:
8887
}
8988

9089
private def copyRunButtons(snippet: html.Element) = {
90+
val copyButtonIcon = s"""<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
91+
<path d="M2.5 2.5V9.5H4V11H2C1.44772 11 1 10.5523 1 10V2C1 1.44772 1.44772 1 2 1H10C10.5523 1 11 1.44772 11 2V4H9.5V2.5H2.5Z" fill="#A09FA6"/>
92+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 6C5 5.44772 5.44772 5 6 5H14C14.5523 5 15 5.44772 15 6V14C15 14.5523 14.5523 15 14 15H6C5.44772 15 5 14.5523 5 14V6ZM6.5 13.5V6.5H13.5V13.5H6.5Z" fill="#A09FA6"/>
93+
</svg>
94+
"""
9195
def copyButton = {
9296
div(
93-
button(cls := "copy-button")(
94-
i(cls := "far fa-clone")
95-
).tap(_.addEventListener("click", _ => {
97+
button(cls := "copy-button icon-button").tap(_.addEventListener("click", _ => {
9698
val code = snippet.querySelectorAll("code>span:not(.hidden)")
9799
.map(_.textContent)
98100
.mkString
@@ -104,7 +106,6 @@ class CodeSnippets:
104106
val runButton = button(cls := "run-button")(
105107
i(cls := "fas fa-play")
106108
)
107-
108109
runButton.addEventListener("click", _ =>
109110
if !runButton.hasAttribute("opened") then {
110111
scastie.Embedded(snippet.querySelector("pre"), scastieConfig)

scaladoc/resources/dotty_res/hljs/highlight.min.js

Lines changed: 0 additions & 1340 deletions
This file was deleted.

scaladoc/resources/dotty_res/hljs/highlight.pack.js

Lines changed: 1064 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Lines changed: 4 additions & 0 deletions

0 commit comments

Comments
 (0)