# HG changeset patch # User Tomas Zeman # Date 1547562300 -3600 # Node ID 5af9883f11110970fdec1537bc6873fe2a390237 # Parent fa9e69404c68433b955e7e2d10bf1ecb5d3e5571 Example/demo diff -r fa9e69404c68 -r 5af9883f1111 build.sbt --- a/build.sbt Fri Jan 19 10:37:09 2018 +0000 +++ b/build.sbt Tue Jan 15 15:25:00 2019 +0100 @@ -3,7 +3,7 @@ val scalaVersions = Seq("2.11.12", "2.12.4") lazy val fatagsRoot = project.in(file(".")). - aggregate(fatagsJS, fatagsJVM). + aggregate(fatagsJS, fatagsJVM, example). settings( crossScalaVersions := scalaVersions, publish := {}, @@ -46,4 +46,8 @@ lazy val fatagsJS = fatags.js lazy val fatagsJVM = fatags.jvm +lazy val example = project.in(file("example")) + .enablePlugins(ScalaJSPlugin) + .dependsOn(fatagsJS) + // vim: et ts=2 sw=2 syn=scala diff -r fa9e69404c68 -r 5af9883f1111 example.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example.html Tue Jan 15 15:25:00 2019 +0100 @@ -0,0 +1,19 @@ + + + + +FA tags example + + + + + + +
Please run sbt fastOptJS to build the demo. Then reload this page.
+ + + + + diff -r fa9e69404c68 -r 5af9883f1111 example/src/main/scala/example/Example.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/src/main/scala/example/Example.scala Tue Jan 15 15:25:00 2019 +0100 @@ -0,0 +1,51 @@ +package example + +import fontawesome.jsdom.FA._ +import org.scalajs.dom +import scalatags.JsDom.all._ + +import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel} + +@JSExportTopLevel("Example") +object Example { + + @JSExport + def main(): Unit = { + val el = dom.document.getElementById("main") + el.innerHTML = "" + el.appendChild(div(cls:="pure-u-1", margin:="1em", + h1("Font awesome demo..."), + h2("Larger icons"), + div(cls:="pure-g", + div(cls:="pure-u-1-5", faCameraRetro.lg, "fa-lg"), + div(cls:="pure-u-1-5", faCameraRetro.x2, "fa-2x"), + div(cls:="pure-u-1-5", faCameraRetro.x3, "fa-3x"), + div(cls:="pure-u-1-5", faCameraRetro.x4, "fa-4x"), + div(cls:="pure-u-1-5", faCameraRetro.x5, "fa-5x") + ), + h2("Fixed width icons (default)"), + div(cls:="pure-u-1", faHome, "Home"), + div(cls:="pure-u-1", faBook, "Library"), + div(cls:="pure-u-1", faPencil, "Applications"), + div(cls:="pure-u-1", faCog, "Settings"), + h2("List icons"), + ul(cls:="fa-ul", + li(faCheckSquare.li, "List icons"), + li(faCheckSquare.li, "can be used"), + li(faSpinner.li.spin, "as bullets"), + li(faSquare.li, "in lists") + ), + h2("Bordered & Pulled Icons"), + div(cls:="pure-u-1-4", + faQuoteLeft.x3.pullLeft.border, + s"""...tomorrow we will run faster, stretch out our arms farther... + And then one fine morning - So we beat on, boats against the + current, borne back ceaselessly into the past."""), + h2("Animated Icons "), + div(cls:="pure-u-1", + faSpinner.x3.spin, faCircleONotch.x3.spin, faRefresh.x3.spin, + faCog.x3.spin, faSpinner.x3.pulse + ) + ).render) + } +}