Skip to content

Commit ca8c06b

Browse files
committed
add style for supertypes and subtypes
1 parent 55e355f commit ca8c06b

File tree

6 files changed

+49
-5
lines changed

6 files changed

+49
-5
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.attributes {
2+
width: 100%;
3+
overflow: hidden;
4+
padding: 0;
5+
margin: 0;
6+
}
7+
8+
.attributes > dt {
9+
float: left;
10+
width: 30%;
11+
padding: 0;
12+
margin: 0;
13+
border-top: 1px solid var(--border-default);
14+
padding-top: calc(2.5 * var(--base-spacing));
15+
padding-bottom: calc(2.5 * var(--base-spacing));
16+
text-align: center;
17+
color: var(--text-secondary);
18+
}
19+
20+
.attributes > dd {
21+
float: left;
22+
width: 70%;
23+
padding: 0;
24+
margin: 0;
25+
border-top: 1px solid var(--border-default);
26+
padding-top: calc(2.5 * var(--base-spacing));
27+
padding-bottom: calc(2.5 * var(--base-spacing));
28+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.subtypes {
2+
background-color: var(--action-primary-background-default-solid);
3+
padding: calc(3 * var(--base-spacing));
4+
padding-bottom: calc(1.5 * var(--base-spacing));
5+
overflow-x: scroll;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.supertypes {
2+
background-color: var(--action-primary-background-default-solid);
3+
padding: calc(3 * var(--base-spacing));
4+
padding-bottom: calc(1.5 * var(--base-spacing));
5+
overflow-x: scroll;
6+
}

scaladoc/resources/dotty_res/styles/theme/layout/content.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
margin-left: calc(39 * var(--base-spacing));
88
display: flex;
99
flex-flow: column;
10+
color: var(--text-primary);
1011
}
1112

1213
#content::after {

scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
1515

1616
def doc(m: Member): Seq[AppliedTag] = m.docs.fold(Nil)(d => Seq(renderDocPart(d.body)))
1717

18-
def tableRow(name: String, content: TagArg) = Seq(dt(name), dd(content))
18+
def tableRow(name: String, content: TagArg) = Seq(dt(cls := "body-small")(name), dd(cls := "body-medium")(content))
1919

2020
def defintionClasses(m: Member) = m.origin match
2121
case Origin.Overrides(defs) =>
@@ -357,9 +357,9 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
357357
))
358358
case _ => Nil
359359

360-
def signatureList(list: Seq[LinkToType]): Seq[AppliedTag] =
360+
def signatureList(list: Seq[LinkToType], className: String = ""): Seq[AppliedTag] =
361361
if list.isEmpty then Nil
362-
else Seq(div(cls := "mono-small-inline")(list.map(link =>
362+
else Seq(div(cls := s"mono-small-inline $className")(list.map(link =>
363363
div(link.kind.name," ", link.signature.map(renderElement))
364364
)))
365365

@@ -369,8 +369,8 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
369369
div(link.signature.map(renderElement))
370370
}})
371371

372-
val supertypes = signatureList(m.parents)
373-
val subtypes = signatureList(m.knownChildren)
372+
val supertypes = signatureList(m.parents, "supertypes")
373+
val subtypes = signatureList(m.knownChildren, "subtypes")
374374
val selfType = selfTypeList(m.selfType.toList)
375375

376376
Seq(

scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ trait Resources(using ctx: DocContext) extends Locations, Writer:
127127
"styles/theme/components/api-member.css",
128128
"styles/theme/components/pill.css",
129129
"styles/theme/components/api-filters.css",
130+
"styles/theme/components/attributes.css",
131+
"styles/theme/components/supertypes.css",
132+
"styles/theme/components/subtypes.css",
130133

131134
"styles/nord-light.css",
132135
"styles/dotty-icons.css",

0 commit comments

Comments
 (0)