All Downloads are FREE. Search and download functionalities are using the official Maven repository.

outwatch.StaticVNodeRender.scala Maven / Gradle / Ivy

The newest version!
package outwatch

import cats.effect.IO
import outwatch.dom.{StaticVNode, StringVNode, VNode}

trait StaticVNodeRender[T] {
  def render(value: T): IO[StaticVNode]
}

object StaticVNodeRender {

  implicit object VNodeRender extends StaticVNodeRender[VNode] {
    def render(value: VNode): IO[StaticVNode] = value
  }

  implicit object StringRender extends StaticVNodeRender[String] {
    def render(value: String): IO[StaticVNode] = IO.pure(StringVNode(value))
  }

  implicit object IntRender extends StaticVNodeRender[Int] {
    def render(value: Int): IO[StaticVNode] = IO.pure(StringVNode(value.toString))
  }

  implicit object DoubleRender extends StaticVNodeRender[Double] {
    def render(value: Double): IO[StaticVNode] = IO.pure(StringVNode(value.toString))
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy