Last active
November 6, 2017 17:27
-
-
Save jaredkhan/1e930c0aeec4379366e98bf96705477d to your computer and use it in GitHub Desktop.
Swift HTML Builder Example
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
struct ImageHero: Nodeable { | |
let background: BackgroundType | |
let imagePath: String | |
let alternateText: String | |
var node: Node { | |
return El.Div[ | |
Attr.className => "ImageHero", | |
Attr.style => background.style | |
].containing( | |
El.Div[ | |
Attr.className => "ImageHero__image", | |
Attr.style => ["background-image": "url('\(imagePath)')"] | |
], | |
El.Div[ | |
Attr.className => "Text--screenReader" | |
].containing(alternateText) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment