This repository has been archived by the owner on Aug 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
significant work on MDL plugin, getting close to comprehensive coverage
- Loading branch information
Showing
20 changed files
with
413 additions
and
85 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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/com/github/sanity/kweb/demos/jquery/jquery.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
76 changes: 59 additions & 17 deletions
76
src/main/kotlin/com/github/sanity/kweb/demos/materialDesignLite/materialDesignLite.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
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
...y/kweb/dom/element/creation/attributes.kt → .../sanity/kweb/dom/attributes/attributes.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
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
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/com/github/sanity/kweb/dom/element/creation/button.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,25 @@ | ||
package com.github.sanity.kweb.dom.element.creation | ||
|
||
import com.github.sanity.kweb.dom.attributes.attr | ||
import com.github.sanity.kweb.dom.element.Element | ||
import com.github.sanity.kweb.dom.attributes.set | ||
|
||
/** | ||
* Created by ian on 1/22/17. | ||
*/ | ||
|
||
|
||
fun Element.button(type: ButtonType? = ButtonType.button, autofocus: Boolean? = null, attributes: Map<String, Any> = attr): ButtonElement { | ||
return ButtonElement(createElement("button", attributes | ||
.set("type", type?.name) | ||
.set("autofocus", autofocus) | ||
)) | ||
} | ||
|
||
open class ButtonElement(val wrapped: Element) : Element(wrapped) { | ||
|
||
} | ||
|
||
enum class ButtonType { | ||
button, reset, submit | ||
} |
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: 2 additions & 0 deletions
2
src/main/kotlin/com/github/sanity/kweb/dom/element/creation/input.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
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/com/github/sanity/kweb/plugins/materialdesignlite/badge.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,19 @@ | ||
package com.github.sanity.kweb.plugins.materialdesignlite | ||
|
||
import com.github.sanity.kweb.dom.element.Element | ||
import com.github.sanity.kweb.dom.element.modification.addClasses | ||
import com.github.sanity.kweb.dom.element.modification.setAttribute | ||
|
||
/** | ||
* Created by ian on 1/21/17. | ||
*/ | ||
|
||
fun MDLElement.badge(value: String? = null, overlap: Boolean = false, noBackground : Boolean = false): Element { | ||
if (this.tag != null && this.tag.toLowerCase() in setOf("span", "link") && value == null) { | ||
throw IllegalArgumentException("value parameter must be present for badge on a <span> or <link> element") | ||
} | ||
return addClasses("mdl-badge") | ||
.addClasses("mdl-badge--overlap", onlyIf = overlap) | ||
.addClasses("mdl-badge--no-background", onlyIf = noBackground) | ||
.setAttribute("data-badge", value) | ||
} |
16 changes: 0 additions & 16 deletions
16
src/main/kotlin/com/github/sanity/kweb/plugins/materialdesignlite/badge/badge.kt
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/com/github/sanity/kweb/plugins/materialdesignlite/button/button.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
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/com/github/sanity/kweb/plugins/materialdesignlite/layout/footer.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,34 @@ | ||
package com.github.sanity.kweb.plugins.materialdesignlite.layout | ||
|
||
import com.github.sanity.kweb.dom.attributes.attr | ||
import com.github.sanity.kweb.dom.attributes.classes | ||
import com.github.sanity.kweb.dom.element.creation.* | ||
import com.github.sanity.kweb.plugins.materialdesignlite.MDLElement | ||
|
||
/** | ||
* See https://getmdl.io/components/index.html#layout-section/footer | ||
*/ | ||
|
||
// TODO: megaFooter | ||
|
||
fun MDLElement.miniFooter(attributes: Map<String, Any> = attr) = MiniFooterElement(footer(attributes.classes("mdl-mini-footer"))) | ||
|
||
class MiniFooterElement(wrapped: FooterElement) : FooterElement(wrapped) { | ||
fun leftSection(attributes: Map<String, Any> = attr) = MiniFooterSection(div(attributes.classes("mdl-mini-footer__left-section"))) | ||
|
||
fun rightSection(attributes: Map<String, Any> = attr) = MiniFooterSection(div(attributes.classes("mdl-mini-footer__right-section"))) | ||
} | ||
|
||
class MiniFooterSection(wrapped: DivElement) : DivElement(wrapped) { | ||
fun logo(attributes: Map<String, Any> = attr) = div(attributes.classes("mdl-logo")) | ||
|
||
fun linkList(attributes: Map<String, Any> = attr) = ul(attributes.classes("mdl-mini-footer__link-list")) | ||
|
||
// TODO: User needs to be able to specify their own social button css classes, see: | ||
// TODO: https://github.com/google/material-design-lite/blob/88872e672e41c56af0a78a35b34373b8c4a8c49d/docs/_assets/main.css#L533 | ||
fun socialButton(attributes: Map<String, Any> = attr) = button(attributes = attributes.classes("mdl-mini-footer__social-btn")) | ||
} | ||
|
||
enum class MiniFooterSide { | ||
left, right | ||
} |
Oops, something went wrong.