simerplaha / SwayDB.website

Website for SwayDB - https://swaydb.simer.au

Home Page:https://swaydb.simer.au

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwayDB.website - OLD documentation

http://swaydb.io/

Website for SwayDB written in Scala.js with scalajs-react.

All documentation pages are written in HTML/VDOM and prior knowledge of React is not required to update or add new documentation pages.

Creating Pages

Create a Page type in Page.scala.

object MyPage extends Page {

    import japgolly.scalajs.react.vdom.html_<^.{<, _}

    override val name: String = "My page"
    override val subPages: Seq[Page] = Seq()
    override val url: String = "mypage/" //unique URL
    override def render(): VdomElement =
      <.div("My page") //implement the HTML for the page here or preferably in another object type.
  }
  • To add MyPage as one of the root pages, add it to the RootPages.pages in Page.scala.
  • To add MyPage as one of the subPages of another Page, add it to the subPages field of the target Page in Page.scala.

Done!

Updating Pages

All Pages follow the above structure that are simple HTML functions. Updating the Pages require updating the HTML of the render functions.

Creating Links

Internal link

LinkIn(Page.MyPage)

External link

LinkOut("http://swaydb.io/", "SwayDB docs")

Adding code snippets

ScalaCode(
  """
    |object MyCodeSnippet {
    |
    |   println("My code snippet")
    |
    |}
  """.stripMargin
)

Building & running

sbt fastOptJS

or

sbt fullOptJS //To build and minify.

Add ~ to start auto build on code changes.

sbt ~fastOptJS

All output JS files and other static files (html, css, img etc) are added to the docs folder. Run the following in the docs folder to start serving index.html on python server.

python -m SimpleHTTPServer

Read more on Scala.js documentation on building.

About

Website for SwayDB - https://swaydb.simer.au

https://swaydb.simer.au

License:MIT License


Languages

Language:Scala 98.6%Language:CSS 1.4%