--- 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
--- /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 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>FA tags example</title>
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
+<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+
+<body>
+<div id="main">Please run sbt fastOptJS to build the demo. Then reload this page.</div>
+<script type="text/javascript" src="example/target/scala-2.12/example-fastopt.js"></script>
+<script>
+Example.main();
+</script>
+</body>
+
+</html>
--- /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)
+ }
+}