Skip to content

Accept props without css or className #18

Open
@jvliwanag

Description

@jvliwanag

I wish to be able to create an alternate React.Basic.DOM with emotion Style type as additional input. To make this more ergonomic though, I'm hoping element didn't always require className and css.

I have a draft here which works nicely.

element ::
  forall input base.
  StyledInput input base =>
  ReactComponent {|base} ->
  {|input} ->
  JSX
element = runFn2 _jsx

button ::
  forall input base base_.
  StyledInput input base =>
  Row.Union base base_ R.Props_button =>
  {|input} ->
  JSX
button = element ReactDOM.button'

class StyledInput (input :: Row Type) (base :: Row Type) | input -> base
instance styledInputI ::
  ( RowToList input inputRl
  , StyledInputRl inputRl baseRl
  , ListToRow baseRl base1
  , Row.Cons "className" String base1 base2
  , Row.Nub base2 base
  ) => StyledInput input base

class StyledInputRl (inputRl :: RowList Type) (baseRl :: RowList Type) | inputRl -> baseRl

instance styledInputRlNil :: StyledInputRl Nil Nil
else instance styledInputRlConsCss ::
  StyledInputRl inputTl base =>
  StyledInputRl (Cons "css" Style inputTl) base
else instance styledInputRlConsOther ::
  StyledInputRl inputTl baseTl =>
  StyledInputRl (Cons name v inputTl) (Cons name v baseTl)

Wondering if this is a welcome addition. Perhaps a separate issue is if the React.Basic.DOM alternate with css can also reside here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions