diff --git a/ui/components/src/ui/components/tailwind/form/ActionButtons.scala b/ui/components/src/ui/components/tailwind/form/ActionButtons.scala index 232b3cd..f0cffc6 100644 --- a/ui/components/src/ui/components/tailwind/form/ActionButtons.scala +++ b/ui/components/src/ui/components/tailwind/form/ActionButtons.scala @@ -2,11 +2,12 @@ package ui.components.tailwind.form import com.raquo.laminar.api.L.{*, given} -import works.iterative.ui.UIString +import works.iterative.core.MessageId import works.iterative.ui.components.tailwind.HtmlComponent +import works.iterative.ui.components.tailwind.ComponentContext case class ActionButton[A]( - title: UIString, + name: MessageId, action: A ) @@ -16,19 +17,19 @@ ) object ActionButtons: - class Component[A](actions: Observer[A]) + class Component[A](actions: Observer[A])(using ctx: ComponentContext) extends HtmlComponent[org.scalajs.dom.html.Div, ActionButtons[A]]: override def render(v: ActionButtons[A]) = div( cls("flex justify-end"), - v.actions.zipWithIndex.map { case (ActionButton(title, action), idx) => + v.actions.zipWithIndex.map { case (ActionButton(name, action), idx) => button( tpe("button"), cls(if idx == 0 then "" else "ml-3"), cls( "bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" ), - title, + ctx.messages(s"action.$name.title"), onClick.mapTo(action) --> actions ) }