Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 18 11:10
    Taig edited #475
  • Apr 17 08:00
    Taig opened #475
  • Apr 10 15:34
    AlexITC opened #474
  • Mar 31 17:22
    scala-steward closed #464
  • Mar 31 17:22
    scala-steward commented #464
  • Mar 31 17:22
    scala-steward opened #473
  • Mar 29 18:44
    scala-steward closed #467
  • Mar 29 18:44
    scala-steward commented #467
  • Mar 29 18:44
    scala-steward opened #472
  • Mar 12 20:28
    scala-steward closed #470
  • Mar 12 20:28
    scala-steward commented #470
  • Mar 12 20:28
    scala-steward opened #471
  • Mar 11 06:10
    scala-steward opened #470
  • Mar 10 07:31
    scala-steward closed #468
  • Mar 10 07:31
    scala-steward commented #468
  • Mar 10 07:31
    scala-steward opened #469
  • Mar 08 00:12
    scala-steward opened #468
  • Mar 02 10:25
    zakpatterson closed #307
  • Feb 27 19:58
    scala-steward closed #460
  • Feb 27 19:58
    scala-steward commented #460
Peter Storm
@peterstorm
Hmm does sass loading even work in scala JS / slinky?
Peter Storm
@peterstorm
Ok, figured out the sass part, but still dont understand the type mismatch above
Mardo Del Cid
@mardo
Hi Guys, I think 0.6.6 doesn’t come with IntelliJ support. I’m testing on IntelliJ 2020.2.3. 0.6.5 works for me though.
Peter Storm
@peterstorm
image.png
No one able to help with this please?
Error is this: type mismatch; found : slinky.core.AttrPair[slinky.web.html._aria_attr.type] required: slinky.core.TagMod[slinky.web.svg.svg.tag.type]
nafg
@nafg
Just a guess, are you missing an import?
scalajs-react has similar types and it relies on an implicit, which means you need a certain import
Peter Storm
@peterstorm
Maybe? :D Which one would that be?
nafg
@nafg
dunno, look at some example project source files
Peter Storm
@peterstorm
Yeah, there's not a lot of that going around :(
Øyvind Raddum Berg
@oyvindberg
@peterstorm my guess is that the slinky dom dsl has declared that aria attributes are not valid for svg elements, this is done through implicits. Check the companion object of the svg you're using, you can copy/paste and customize one of the implicits to explicitly allow it in your code
Peter Storm
@peterstorm
Uh, I have no idea how to do that :(
Maybe it's because it uses the wrong operator? Its overloaded and can come from different places
But an AttrPair extends a TagMod
Peter Storm
@peterstorm
I figured it out by mistake! ?D
I was using the wrong aria
but then I did a role and it prefixed it all with slinky.web.svg and I thought, maybe there's an aria one for that
And there was! :D
Peter Storm
@peterstorm
Oh, but there's not data tag in there, damn :(
Peter Storm
@peterstorm
I'm trying to pass a component as props to another component, like so:
image.png
But the compiler says value apply is not a member of slinky.core.facade.ReactElement
The react annotation
Peter Storm
@peterstorm
Well, i guess that doesnt work. How would i pass a component as props then?
Alexis Hernandez
@AlexITC
that's the way to pass the component, I even have something similar (see), sometimes the macro highlights errors but sbt compiles fine
Peter Storm
@peterstorm
@AlexITC Can you point me to where you use that componenet, and pass another component to it? Can't seem to find that :D
1 reply
I'm probably super confused because it's in a trait, and without the react annotation, but it's a cool project to learn from it seems!
1 reply
Peter Storm
@peterstorm
Ah found it. But whati wanna do is give the actual component as a prop. Like if you defined your own component with @react and a val as a functional component
how do i pass that whole component as a type?
though i guess I could just use vals... hmm, I’ll look at that
Alexis Hernandez
@AlexITC
generally it shouldn't be a problem to propagate a component, it is likely you have a different issue, if you post a snippet, I can take a look
Peter Storm
@peterstorm
Yeah, I'll give it a go again, and else I'll post a snippet. But what would be the type of an object that you created with the @react annotation? If I wanted to pass an object like that around?
Alexis Hernandez
@AlexITC
ReactElement is fine, what matters is the component
Peter Storm
@peterstorm
Ok, now that I have this component that I want to take another component as children
@JSImport("resources/scss/card/style.scss", JSImport.Default)
@js.native
object Style extends js.Object

@react
object Card {

    private val css = Style

    case class Props(title: String, className: String, children: ReactElement)

    val component = FunctionalComponent[Props] { props =>
        Grid(className := s"{props.className} cardWrapper")(
            Grid(className := "cardHeader")(
                div(className := "cardHeaderLeft")(
                    h3(props.title)
                )
            ), props.children
        )
    }
}
How do I pass an actual React Component to that then? @AlexITC
Gabor Juhasz
@gjuhasz86

I think in the caller component's render method you can do something like this:

def render = Card(title = "card", className = "mycard")(div("foo"))

(div("foo") being the ReactElement passed as children)

I think if you name a property children, it's special, and becomes a second parameter list
Peter Storm
@peterstorm
I got it to work with this weird syntax that I got from Alex :D
ProfileSearch.component(ProfileSearch.Props(props.search))
But I'll try your way too
Alexis Hernandez
@AlexITC
Such weird syntax is what the macro ends up writing, I use that to avoid the highlighting errors from intellij
Gabor Juhasz
@gjuhasz86
I don't get highlighting errors (after struggling with it for a good while). I assume you are missing the Slinky extension?
1 reply
I'm on Slinky 0.6.6, but the extension didn't work for that version, and I found the previous version in my ivy cache.
~/.ivy2/cache/me.shadaj/slinky-core-ijext_2.12/jars/slinky-core-ijext_2.12-0.6.5.jar
It worked with that (not quite immediately, but eventually)
Peter Storm
@peterstorm
Is it possible to use font-awesome from npm with slinky?
Alexis Hernandez
@AlexITC
I think that material-ui already integrates that one, see https://github.com/ScalablyTyped/SlinkyDemos
Peter Storm
@peterstorm
Hmmm, where exactly? @AlexITC
But your repo has saved me, its much more enjoyable writing Slinky now that i know how to pass components to compoments :)
1 reply
Alexis Hernandez
@AlexITC
4 replies