<commit_before>package io.udash.web.homepage.components.demo

import com.avsystem.commons.SharedExtensions._
import com.avsystem.commons.misc.AutoNamedEnum
import io.udash._
import scalatags.JsDom.all._

trait CodeDemo {
  def rendered: Modifier
  def source: String
}

object HelloDemo extends CodeDemo {
  val (rendered, source) = {
    val name = Property.blank[String]
    div(
      TextInput(name)(),
      p("Hello, ", bind(name), "!"),
    )
  }.withSourceCode
}

object SelectDemo extends CodeDemo {
  val (rendered, source) = {
    sealed trait Fruit extends AutoNamedEnum
    case object Apple extends Fruit
    case object Banana extends Fruit
    case object Orange extends Fruit

    val fruits = Seq(Apple, Banana, Orange)
    val favoriteFruits = SeqProperty[Fruit](Banana)

    div(
      div(Select(favoriteFruits, fruits.toSeqProperty)(_.name)),
      div(produce(favoriteFruits)(_.mkString(",").render)),
    )
  }.withSourceCode
}<commit_msg>Add import to demo<commit_after>package io.udash.web.homepage.components.demo

import com.avsystem.commons.SharedExtensions._
import io.udash._
import scalatags.JsDom.all._

trait CodeDemo {
  def rendered: Modifier
  def source: String
}

object HelloDemo extends CodeDemo {
  val (rendered, source) = {
    val name = Property.blank[String]
    div(
      TextInput(name)(),
      p("Hello, ", bind(name), "!"),
    )
  }.withSourceCode
}

object SelectDemo extends CodeDemo {
  val (rendered, source) = {
    import com.avsystem.commons.misc.AutoNamedEnum

    sealed trait Fruit extends AutoNamedEnum
    case object Apple extends Fruit
    case object Banana extends Fruit
    case object Orange extends Fruit

    val fruits = Seq(Apple, Banana, Orange)
    val favoriteFruits = SeqProperty[Fruit](Banana)

    div(
      div(Select(favoriteFruits, fruits.toSeqProperty)(_.name)),
      div(produce(favoriteFruits)(_.mkString(",").render)),
    )
  }.withSourceCode
}
{'fraction_non_alphanumeric': 0.10640495867768596, 'fraction_numerical': 0.0, 'mean_word_length': 3.7359413202933984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7491735', 'n_tokens_mistral': 630, 'n_tokens_neox': 595, 'n_words': 149}