Skip to content

Commit

Permalink
doc: remove shared model
Browse files Browse the repository at this point in the history
  • Loading branch information
cheleb committed Oct 4, 2024
1 parent 79b8b10 commit 5508a68
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
8 changes: 8 additions & 0 deletions examples/client/src/main/scala/samples/EitherSample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import com.raquo.laminar.api.L.*

val either = {

case class Cat(name: String, age: Int)
case class Dog(name: String, age: Int)
given Defaultable[Cat] with
def default = Cat("", 0)

given Defaultable[Dog] with
def default = Dog("", 0)

@Panel("Either", false)
case class EitherSample(
either: Either[Cat, Dog],
Expand Down
13 changes: 9 additions & 4 deletions examples/client/src/main/scala/samples/EnumSample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package samples

import com.raquo.laminar.api.L.*
import dev.cheleb.scalamigen.*
import io.github.iltotore.iron.*
import io.github.iltotore.iron.constraint.all.*

val enums = {
enum Color(val code: String):
Expand All @@ -15,16 +17,19 @@ val enums = {

case class Cat(
name: String,
age: Int,
color: Color
weight: Int :| Positive,
kind: Boolean = true,
colol: Color
)
// case class Dog(name: String, weight: Int)

val enumVar = Var(
Basket(Color.Black, Cat("Scala", 10, Color.White))
Basket(Color.Black, Cat("Scala", 10, true, Color.White))
)

Sample(
"Enums",
enumVar.asForm,
enumVar.asForm(enumVar.errorBus),
div(
child <-- enumVar.signal.map { item =>
div(
Expand Down
3 changes: 3 additions & 0 deletions examples/client/src/main/scala/samples/SimpleSample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import com.raquo.laminar.api.L.*
import dev.cheleb.scalamigen.*

val simple = {

case class Cat(name: String, weight: Int, kind: Boolean = true)

val simpleVar = Var(Cat("Scala le chat", 6))
Sample(
"Simple",
Expand Down
9 changes: 0 additions & 9 deletions examples/client/src/main/scala/samples/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,4 @@ object Password:
def apply(password: String): Password = password
given Form[Password] = secretForm(apply)

case class Cat(name: String, weight: Int, kind: Boolean = true)
case class Dog(name: String, weight: Int)

given Defaultable[Cat] with
def default = Cat("", 0)

given Defaultable[Dog] with
def default = Dog("", 0)

given WidgetFactory = if true then UI5WidgetFactory else LaminarWidgetFactory

0 comments on commit 5508a68

Please sign in to comment.