Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
Update react common an mark childess componunts as such
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Quiroz <[email protected]>
  • Loading branch information
cquiroz committed Jan 11, 2020
1 parent a5ae010 commit adfe2fe
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 221 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ lazy val facade =
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % scalaJsReact,
"com.github.japgolly.scalajs-react" %%% "extra" % scalaJsReact,
"io.github.cquiroz.react" %%% "common" % "0.4.0",
"io.github.cquiroz.react" %%% "common" % "0.4.2",
"com.github.japgolly.scalajs-react" %%% "test" % scalaJsReact % Test,
"com.lihaoyi" %%% "utest" % "0.7.2" % Test,
"org.typelevel" %%% "cats-core" % "2.1.0" % Test
Expand Down
33 changes: 13 additions & 20 deletions facade/src/main/scala/react/semanticui/addons/confirm/Confirm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,20 @@ import react.semanticui.modules.modal._
import react.semanticui.{ raw => suiraw }

final case class Confirm(
cancelButton: js.UndefOr[VdomNode | Button.ButtonProps] = js.undefined,
confirmButton: js.UndefOr[VdomNode | Button.ButtonProps] = js.undefined,
content: js.UndefOr[VdomNode | ModalContent.ModalContentProps] = js.undefined,
header: js.UndefOr[VdomNode | ModalHeader.ModalHeaderProps] = js.undefined,
onCancelE: js.UndefOr[Confirm.OnCancel] = js.undefined,
onCancel: js.UndefOr[Callback] = js.undefined,
onConfirmE: js.UndefOr[Confirm.OnConfirm] = js.undefined,
onConfirm: js.UndefOr[Callback] = js.undefined,
open: js.UndefOr[Boolean] = js.undefined,
size: js.UndefOr[ModalSize] = js.undefined,
override val children: CtorType.ChildrenArgs = Seq.empty
) extends GenericComponentPC[Confirm.ConfirmProps] {
cancelButton: js.UndefOr[VdomNode | Button.ButtonProps] = js.undefined,
confirmButton: js.UndefOr[VdomNode | Button.ButtonProps] = js.undefined,
content: js.UndefOr[VdomNode | ModalContent.ModalContentProps] = js.undefined,
header: js.UndefOr[VdomNode | ModalHeader.ModalHeaderProps] = js.undefined,
onCancelE: js.UndefOr[Confirm.OnCancel] = js.undefined,
onCancel: js.UndefOr[Callback] = js.undefined,
onConfirmE: js.UndefOr[Confirm.OnConfirm] = js.undefined,
onConfirm: js.UndefOr[Callback] = js.undefined,
open: js.UndefOr[Boolean] = js.undefined,
size: js.UndefOr[ModalSize] = js.undefined
) extends GenericComponentP[Confirm.ConfirmProps] {
override def cprops = Confirm.props(this)
@inline def renderWith =
@inline def render =
Confirm.component(Confirm.props(this))
override def withChildren(children: CtorType.ChildrenArgs) =
copy(children = children)
}

object Confirm {
Expand Down Expand Up @@ -123,10 +120,6 @@ object Confirm {
}

private val component =
JsComponent[ConfirmProps, Children.Varargs, Null](RawComponent)
JsComponent[ConfirmProps, Children.None, Null](RawComponent)

def apply(
content: VdomNode*
): Confirm =
new Confirm(children = content)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@ import js.annotation._
import js.|
import japgolly.scalajs.react._
import japgolly.scalajs.react.raw.JsNumber
import japgolly.scalajs.react.vdom.VdomNode
import react.semanticui._
import react.common._
import react.common.style._

final case class ButtonOr(
as: js.UndefOr[AsC] = js.undefined,
className: js.UndefOr[String] = js.undefined,
clazz: js.UndefOr[Css] = js.undefined,
text: js.UndefOr[JsNumber | String] = js.undefined,
override val children: CtorType.ChildrenArgs = Seq.empty
) extends GenericComponentPC[ButtonOr.ButtonOrProps] {
as: js.UndefOr[AsC] = js.undefined,
className: js.UndefOr[String] = js.undefined,
clazz: js.UndefOr[Css] = js.undefined,
text: js.UndefOr[JsNumber | String] = js.undefined
) extends GenericComponentP[ButtonOr.ButtonOrProps] {
override def cprops = ButtonOr.props(this)
@inline def renderWith =
@inline def render =
ButtonOr.component(ButtonOr.props(this))
override def withChildren(children: CtorType.ChildrenArgs) =
copy(children = children)
}

object ButtonOr {
Expand Down Expand Up @@ -67,10 +63,6 @@ object ButtonOr {
}

private val component =
JsComponent[ButtonOrProps, Children.Varargs, Null](RawComponent)
JsComponent[ButtonOrProps, Children.None, Null](RawComponent)

def apply(
content: VdomNode*
): ButtonOr =
new ButtonOr(children = content)
}
24 changes: 9 additions & 15 deletions facade/src/main/scala/react/semanticui/elements/flag/Flag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ import react.semanticui._
import react.common.style._

final case class Flag(
as: js.UndefOr[AsC] = js.undefined,
className: js.UndefOr[String] = js.undefined,
clazz: js.UndefOr[Css] = js.undefined,
name: js.UndefOr[String] = js.undefined,
override val children: CtorType.ChildrenArgs = Seq.empty
) extends GenericComponentPC[Flag.FlagProps] {
override def cprops = Flag.props(this)
@inline def renderWith = Flag.component(Flag.props(this))
override def withChildren(children: CtorType.ChildrenArgs) =
copy(children = children)
as: js.UndefOr[AsC] = js.undefined,
className: js.UndefOr[String] = js.undefined,
clazz: js.UndefOr[Css] = js.undefined,
name: js.UndefOr[String] = js.undefined
) extends GenericComponentP[Flag.FlagProps] {
override def cprops = Flag.props(this)
@inline def render = Flag.component(Flag.props(this))
}

object Flag {
Expand Down Expand Up @@ -56,10 +53,7 @@ object Flag {
}

private val component =
JsComponent[FlagProps, Children.Varargs, Null](RawComponent)
JsComponent[FlagProps, Children.None, Null](RawComponent)

def apply(
name: String
): Flag =
new Flag(name = name)
def apply(name: String): Flag = new Flag(name = name)
}
48 changes: 22 additions & 26 deletions facade/src/main/scala/react/semanticui/elements/icon/Icon.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,26 @@ import scala.scalajs.js.|
import js.annotation._

final case class Icon(
as: js.UndefOr[AsC] = js.undefined,
bordered: js.UndefOr[Boolean] = js.undefined,
circular: js.UndefOr[Boolean] = js.undefined,
className: js.UndefOr[String] = js.undefined,
clazz: js.UndefOr[Css] = js.undefined,
color: js.UndefOr[SemanticColor] = js.undefined,
corner: js.UndefOr[IconCorner] = js.undefined,
disabled: js.UndefOr[Boolean] = js.undefined,
fitted: js.UndefOr[Boolean] = js.undefined,
flipped: js.UndefOr[IconFlip] = js.undefined,
inverted: js.UndefOr[Boolean] = js.undefined,
link: js.UndefOr[Boolean] = js.undefined,
loading: js.UndefOr[Boolean] = js.undefined,
name: js.UndefOr[suiraw.SemanticICONS] = js.undefined,
rotated: js.UndefOr[IconRotated] = js.undefined,
size: js.UndefOr[SemanticSize] = js.undefined,
ariaLabel: js.UndefOr[String] = js.undefined,
override val children: CtorType.ChildrenArgs = Seq.empty
) extends GenericComponentPC[Icon.IconProps] {
override def cprops = Icon.props(this)
@inline def renderWith = Icon.component(Icon.props(this))
override def withChildren(children: CtorType.ChildrenArgs) =
copy(children = children)
as: js.UndefOr[AsC] = js.undefined,
bordered: js.UndefOr[Boolean] = js.undefined,
circular: js.UndefOr[Boolean] = js.undefined,
className: js.UndefOr[String] = js.undefined,
clazz: js.UndefOr[Css] = js.undefined,
color: js.UndefOr[SemanticColor] = js.undefined,
corner: js.UndefOr[IconCorner] = js.undefined,
disabled: js.UndefOr[Boolean] = js.undefined,
fitted: js.UndefOr[Boolean] = js.undefined,
flipped: js.UndefOr[IconFlip] = js.undefined,
inverted: js.UndefOr[Boolean] = js.undefined,
link: js.UndefOr[Boolean] = js.undefined,
loading: js.UndefOr[Boolean] = js.undefined,
name: js.UndefOr[suiraw.SemanticICONS] = js.undefined,
rotated: js.UndefOr[IconRotated] = js.undefined,
size: js.UndefOr[SemanticSize] = js.undefined,
ariaLabel: js.UndefOr[String] = js.undefined
) extends GenericComponentP[Icon.IconProps] {
override def cprops = Icon.props(this)
@inline def render = Icon.component(Icon.props(this))
}

object Icon {
Expand Down Expand Up @@ -91,7 +88,7 @@ object Icon {
}

private val component =
JsComponent[IconProps, Children.Varargs, Null](RawComponent)
JsComponent[IconProps, Children.None, Null](RawComponent)

def apply(name: String): Icon =
new Icon(as = js.undefined,
Expand All @@ -110,6 +107,5 @@ object Icon {
name = name,
rotated = js.undefined,
size = js.undefined,
ariaLabel = js.undefined,
children = Seq.empty)
ariaLabel = js.undefined)
}
39 changes: 13 additions & 26 deletions facade/src/main/scala/react/semanticui/elements/icon/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = s,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def color(s: SemanticColor): Icon =
new Icon(as = i.as,
Expand All @@ -76,8 +75,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def flipped(s: IconFlip): Icon =
new Icon(as = i.as,
Expand All @@ -96,8 +94,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def rotated(s: IconRotated): Icon =
new Icon(as = i.as,
Expand All @@ -116,8 +113,7 @@ package object icon {
name = i.name,
rotated = s,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def bordered(): Icon =
new Icon(as = i.as,
Expand All @@ -136,8 +132,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def circular(): Icon =
new Icon(as = i.as,
Expand All @@ -156,8 +151,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def className(c: String): Icon =
new Icon(as = i.as,
Expand All @@ -176,8 +170,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def corner(c: IconCorner): Icon =
new Icon(as = i.as,
Expand All @@ -196,8 +189,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def disabled: Icon =
new Icon(as = i.as,
Expand All @@ -216,8 +208,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def fitted: Icon =
new Icon(as = i.as,
Expand All @@ -236,8 +227,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def inverted: Icon =
new Icon(as = i.as,
Expand All @@ -256,8 +246,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def link: Icon =
new Icon(as = i.as,
Expand All @@ -276,8 +265,7 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)

def loading: Icon =
new Icon(as = i.as,
Expand All @@ -296,7 +284,6 @@ package object icon {
name = i.name,
rotated = i.rotated,
size = i.size,
ariaLabel = i.ariaLabel,
children = i.children)
ariaLabel = i.ariaLabel)
}
}
Loading

0 comments on commit adfe2fe

Please sign in to comment.