diff --git a/examples/client/src/main/scala/Index.scala b/examples/client/src/main/scala/Index.scala index 1f3fbd3..4b0d60f 100644 --- a/examples/client/src/main/scala/Index.scala +++ b/examples/client/src/main/scala/Index.scala @@ -24,6 +24,7 @@ object App extends App { private val demos = Seq( samples.simple, + samples.opaque, samples.either, samples.validation, samples.enums, diff --git a/examples/client/src/main/scala/samples/OpaqueType.scala b/examples/client/src/main/scala/samples/OpaqueType.scala new file mode 100644 index 0000000..bc7643e --- /dev/null +++ b/examples/client/src/main/scala/samples/OpaqueType.scala @@ -0,0 +1,36 @@ +package samples + +import com.raquo.laminar.api.L.* +import dev.cheleb.scalamigen.* + +val opaque = { + + case class Person( + name: String, + password: Password + ) + + val simpleVar = Var(Person("Vlad", Password("123456"))) + Sample( + "Opaque Type", + simpleVar.asForm, + div( + child <-- simpleVar.signal.map { item => + div( + s"$item" + ) + } + ), + """ + |case class Person( + | name: String, + | weight: Int, + | hairsCount: BigInt :| GreaterEqual[100000], + | kind: Boolean = true) + | + |val simpleVar = Var(Person("Vlad", 66, BigInt(100000).refineUnsafe)) + | + |simpleVar.asForm + """.stripMargin + ) +}