Skip to content

PasteStack/paste-surface-scala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paste-surface-scala

Scala/Twirl implementation of PasteStack Surface Rendering Layer.

Installation

// build.sbt
libraryDependencies += "com.pastestack" %% "paste-surface-scala" % "0.1.0"

Usage

ViewModels

import com.pastestack.surface._

val pageMeta = PageMeta(
  siteName = "My Site",
  title = "Home",
  description = "Welcome to my site",
  themeColor = "336699"
)

val hero = Hero(
  name = "main",
  showImage = true,
  stickyNavTarget = true
)

val address = Address(
  street1 = "123 Main St",
  locality = "Springfield",
  region = "IL",
  postalCode = "62701",
  countryCode = "USA"
)

Templates

// In your Twirl template
@import paste.surface.layouts.html.webbase
@import paste.surface.components.html.hero
@import com.pastestack.surface._

@webbase(pageMeta) {
  @* headContent *@
  <link rel="stylesheet" href="/css/main.css">
} {
  @* navContent *@
  <nav>...</nav>
} {
  @* mainContent *@
  @hero(Hero("main", showImage = true)) {
    <h1>Welcome</h1>
  }
} {
  @* footerContent *@
  <p>&copy; 2025</p>
} {
  @* scriptIncludes *@
  <script src="/js/main.js"></script>
}

Package Structure

com.pastestack.surface
├── viewmodels/
│   ├── page/
│   │   └── PageMeta
│   ├── components/
│   │   ├── Hero
│   │   ├── Address
│   │   └── form/
│   │       ├── FormFieldInput
│   │       ├── FormFieldButton
│   │       ├── FormFieldTextarea
│   │       └── HelpToolTip
│   └── assets/
│       ├── CSSInclude
│       └── JSInclude

paste.surface (Twirl templates)
├── layouts/
│   └── webbase.scala.html
├── components/
│   ├── hero.scala.html
│   ├── address.scala.html
│   └── form/
│       ├── formfieldinput.scala.html
│       ├── formfieldbutton.scala.html
│       ├── formfieldtextarea.scala.html
│       └── formfieldhiddenpassthroughs.scala.html
└── assets/
    ├── cssinclude.scala.html
    └── jsinclude.scala.html

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages