diff options
author | Filip Zybała <fzybala@virtuslab.com> | 2020-05-12 09:36:09 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-05-20 15:22:42 +0200 |
commit | 13be83e525dd889ff127a41d776f6635799530a4 (patch) | |
tree | 9027ebd1baa91f78ae7ce2eb9fbad211d1947c44 /plugins/base/src/main/kotlin/renderers/html | |
parent | 5b6e8564808c3ab2ebe5b94c2a7e59971bfc4003 (diff) | |
download | dokka-13be83e525dd889ff127a41d776f6635799530a4.tar.gz dokka-13be83e525dd889ff127a41d776f6635799530a4.tar.bz2 dokka-13be83e525dd889ff127a41d776f6635799530a4.zip |
Prepared styles for tags and tabs coloring as in figma.
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 388ee72f..85005bc0 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -81,6 +81,15 @@ open class HtmlRenderer( button(classes = "platform-bookmark") { if (index == 0) attributes["data-active"] = "" attributes["data-toggle"] = pair.first.sourceSetName + when( + pair.first.platform.key + ){ + "common" -> classes = classes + "common-like" + "native" -> classes = classes + "native-like" + "jvm" -> classes = classes + "jvm-like" + "js" -> classes = classes + "js-like" + } + attributes["data-toggle"] = pair.first.sourceSetName text(pair.first.sourceSetName) } } @@ -230,14 +239,18 @@ open class HtmlRenderer( } } - private fun FlowContent.createPlatformTags(node: ContentNode, sourceSetRestriction: Set<SourceSetData>? = null) { node.takeIf { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }?.let { div("platform-tags") { - node.sourceSets.filter { sourceSetRestriction == null || it in sourceSetRestriction }.forEach { + node.sourceSets.filter { sourceSetRestriction == null || it in sourceSetRestriction }.forEach { data -> div("platform-tag") { - if (it.sourceSetName.equals("common", ignoreCase = true)) classes = classes + "common" - text(it.sourceSetName) + when(data.platform.key){ + "common" -> classes = classes + "common-like" + "native" -> classes = classes + "native-like" + "jvm" -> classes = classes + "jvm-like" + "js" -> classes = classes + "js-like" + } + text(data.sourceSetName) } } } |