-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
1 parent
fcea6e2
commit efbad98
Showing
22 changed files
with
651 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rise/results/presentation/HtmlElements.kt → ...bitrise/core/presentation/HtmlElements.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
core/src/main/kotlin/net/lachlanmckee/bitrise/core/presentation/MaterialDesign.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package net.lachlanmckee.bitrise.core.presentation | ||
|
||
import kotlinx.html.* | ||
|
||
fun HTML.materialHeader(contentFunc: HEAD.() -> Unit = {}) { | ||
head { | ||
link(rel = "stylesheet", href = "https://fonts.googleapis.com/icon?family=Material+Icons") | ||
link(rel = "stylesheet", href = "https://code.getmdl.io/1.3.0/material.teal-indigo.min.css") | ||
script { | ||
src = "https://code.getmdl.io/1.3.0/material.min.js" | ||
} | ||
link(rel = "stylesheet", href = "/static/styles.css", type = "text/css") | ||
|
||
contentFunc(this) | ||
} | ||
} | ||
|
||
fun HTML.materialBody( | ||
title: String, | ||
linksFunc: NAV.(MaterialLinkMode) -> Unit = {}, | ||
contentFunc: HtmlBlockTag.() -> Unit | ||
) { | ||
body { | ||
div { | ||
classes = setOf("mdl-layout", "mdl-js-layout", "mdl-layout--fixed-header") | ||
header("mdl-layout__header") { | ||
div("mdl-layout__header-row") { | ||
span("mdl-layout-title") { +title } | ||
|
||
nav { | ||
classes = setOf("mdl-navigation") | ||
linksFunc(MaterialLinkMode.TOOLBAR) | ||
} | ||
} | ||
} | ||
div("mdl-layout__drawer") { | ||
span("mdl-layout-title") { +title } | ||
|
||
nav { | ||
classes = setOf("mdl-navigation") | ||
linksFunc(MaterialLinkMode.DRAWER) | ||
} | ||
} | ||
main("mdl-layout__content") { | ||
div("page-content") { | ||
contentFunc() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun NAV.materialStandardLink(text: String, href: String, icon: String, newWindow: Boolean) { | ||
a(href, if (newWindow) "_blank" else "_self") { | ||
classes = setOf("mdl-navigation__link", "mdl-navigation__link--icon") | ||
i { | ||
classes = setOf("material-icons") | ||
text(icon) | ||
} | ||
span { | ||
text(text) | ||
} | ||
} | ||
} | ||
|
||
fun NAV.materialJavascriptLink(text: String, onClick: String, icon: String) { | ||
a("#") { | ||
this.onClick = onClick | ||
classes = setOf("mdl-navigation__link", "mdl-navigation__link--icon") | ||
i { | ||
classes = setOf("material-icons") | ||
text(icon) | ||
} | ||
span { | ||
text(text) | ||
} | ||
} | ||
} | ||
|
||
enum class MaterialLinkMode { | ||
TOOLBAR, DRAWER | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.