Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 20 05:39

    shadaj on master

    Add 'textarea' to the list of c… (compare)

  • Jul 20 05:39
    shadaj closed #492
  • Jul 19 17:40
    godenji commented #461
  • Jul 17 11:24
    mn98 opened #492
  • Jul 15 09:27
    myyk edited #491
  • Jul 15 09:27
    myyk opened #491
  • Jul 12 12:03
    scala-steward opened #490
  • Jul 12 00:38
    scala-steward synchronize #463
  • Jul 11 23:05

    shadaj on master

    Update sbt-scalafmt to 2.4.3 (#… (compare)

  • Jul 11 23:05
    shadaj closed #488
  • Jul 11 23:05

    shadaj on master

    Update resources.md (#487) (compare)

  • Jul 11 23:05
    shadaj closed #487
  • Jul 11 15:03
    nizhegorodets opened #489
  • Jul 09 01:52
    scala-steward opened #488
  • Jul 07 18:19
    AlexITC opened #487
  • Jul 05 04:28
    scala-steward opened #486
  • Jul 05 03:09

    shadaj on master

    Update sbt to 1.5.4 (#485) (compare)

  • Jul 05 03:09
    shadaj closed #485
  • Jul 05 03:09

    shadaj on master

    Update sbt-pgp to 2.0.2 (#451) … (compare)

  • Jul 05 03:09
    shadaj closed #451
zetashift
@zetashift
Will Scala 3 top level function definitions allow Slinky to have functional components without wrapping it in an object?
shadaj
@shadaj:matrix.org
[m]
@zetashift: yes! will probably still need a macro to get the nice apply with inlined props but won't need a wrapping object anymore
zetashift
@zetashift
very cool!!
mn98
@mn98
Hi all, this may be a very silly question, but... how do I set the style of a slinky.web.html.div element? Should I be using slinky-styled-components?
mn98
@mn98
I haven't done anything with styling yet and I have zero css experience! I'm genuinely looking for any advice/opinions on how to proceed.
zetashift
@zetashift
@mn98 maybe you can simply use the tag style thing: https://slinky.dev/docs/the-tag-api/ (It's under section 'Styles')
scala h1(style := js.Dynamic.literal( fontSize = "30px" ))( "hello!" )
mn98
@mn98
@zetashift thanks, that is indeed much simpler! Still, the styled-components thing does look quite cool.
zetashift
@zetashift
Personally, not the biggest fan of styled components, but that might be because I have very little experience with it, and only had bad experience reading some JS React styled components
mn98
@mn98
@zetashift noted, thanks for sharing. I'm a sucker for a shiny website and a good sales pitch :-)
zetashift
@zetashift
@mn98 same actually :D!
Jeremy Hughes
@jedahu
Hi @shadaj:matrix.org I've added more info on my issue: shadaj/slinky-styled-components#6
Ján Nosál
@JanNosal
@mn98 My opinion: It depends on what your goal is. If you are just doing something small, style attribute might be OK. However AFAIK inline styling is discouraged in general (not just in React). You might get into big maintainability issues as your projects grows. I suggest you check CSS-IN-JS (lhttps://reactjs.org/docs/faq-styling.html) solutions in javascript React ecosystem (for example this article https://medium.com/@dmitrynozhenko/9-ways-to-implement-css-in-react-js-ccea4d543aa3), which helps with separations of concerns hence improve maintainability of you project. If there are not typings in scala.js for library of your choice - to write them ad-hoc for just your project is fairly easy (you don't need to cover whole library, just what you need when you need it).
mn98
@mn98
@JanNosal thanks very much, I'll have a read through that material!
Ján Nosál
@JanNosal
@mn98 np. the second link is broken, here once again: https://medium.com/@dmitrynozhenko/9-ways-to-implement-css-in-react-js-ccea4d543aa3 btw styled components is one of the possible solutions.
Jeremy Hughes
@jedahu

I have an issue with slinky-styled-components and lazy object initialization.

Given this definition:

@react object Logo {
  type Props = Unit

  val wordmark = &.a(css"text-align: center;")

  val component = FunctionalComponent[Props] { _ =>
    div(wordmark(href := "https://example.com", img(src := "/image.svg")))
  }
}

Use of Logo() in another component results in a runtime warning about dynamic component creation:

@react object Demo {
  type Props = Unit

  val component = FunctionalComponent[Props] { _ => Logo() }
}
styled-components.browser.esm.js:28 The component styled.a with the id of "sc-hKwCoD" has been created dynamically.
You may see this warning because you've called styled inside another component.
To resolve this only create new StyledComponents outside of any render method and function component.

I've worked around it by forcing early evaluation of Logo:

@react object Demo {
  type Props = Unit

  Logo

  val component = FunctionalComponent[Props] { _ => Logo() }
}

Anyone have a better approach?

nafg
@nafg
Does Slinky have sample projects, and if so how do you maintain them? (In Slick there's a lot of code in the SBT build dealing with it, which I'd like to simplify or eliminate, and I'm trying to find out what other people do.) For instance, do sample projects each have their own repo or are they subdirectories in the same repo? If the latter, are they part of the main SBT build, do they have their own SBT build, or both? In any case do you automate keeping them up to date, and if so, how?
Øyvind Raddum Berg
@oyvindberg
@nafg in ST there are heaps of demos which are released simultaneously with the converter, ensuring that they all compile with the newest encoding. They are divided into three repos. I wrote this release script https://github.com/ScalablyTyped/Converter/blob/master/release.sc to deal with it. Pretty happy with that setup so far.
Andrija Vranic
@ydrea
hi! where does one report a typo in the documentation?
mazugrin
@mazugrin
Hi, it seems like slinky.web.html.dt and slinky.web.html.dd have disappeared (although slinky.web.html.dl still exists). Does anyone know how I can use a dl without a dt or dd? Thank you!
shadaj
@shadaj:matrix.org
[m]
@jedahu: hmm, that's likely going to just be a limitation imposed by object initialization semantics; manual initialization is probably the way to go unfortunately
@ydrea: just drop an issue on the main GitHub repo!
@nafg: the main "sample" that Slinky has is the docs page, which does a fairly good job of exercising the different features; I maintain it as a subproject so that I can track bundle size effects of PRs
@mazugrin: those were removed recently since they are deprecated elements (and had their corresponding types removed from the official Scala.js DOM types); if you still need to use them, you can just create a custom tag (https://slinky.dev/docs/custom-tags-and-attributes/)
mazugrin
@mazugrin
Sorry - I guess I am wondering why Scala.JS DOM dropped them - do you happen to know why?
shadaj
@shadaj:matrix.org
[m]
Actually, taking a closer look, the types were dropped because html.Element is sufficient for the core interface. Just created shadaj/slinky#477 to bring the tags back.
mazugrin
@mazugrin
Oh cool - I think that makes more sense. I was starting to wonder if there was some moral judgement against using dt or dd!
Alexander Samsig
@asamsig:matrix.org
[m]
Hi @shadaj , is there any work or plans being done yet for migrating to Scala3?
nafg
@nafg
@shadaj:matrix.org follow-up question: Have you ever wanted the sample to be valid as a standalone build?
shadaj
@shadaj:matrix.org
[m]
Alexander Samsig: not quite yet, unfortunately haven't been able to explore what Slinky on Scala 3 would look like yet; I think the core components should work but not sure how @react would look
1 reply
@nafg: valid as in you can run SBT from that folder? not really since the Giter8 template is meant to be the reference for new projects
Alvin Alexander
@alvinj
Hi, I was wondering if anyone has created the simplest possible “Hello, world” Slinky example? I just started working with Slinky and used sbt new shadaj/create-react-scala-app.g8 to get that project running, but I’m trying to understand what the bare minimum essentials are. Thanks.
shadaj
@shadaj:matrix.org
[m]
@alvinj: https://www.youtube.com/watch?v=oe14Hq_Uyv8 might be somewhat relevant, it sets up a Slinky project but without any of the Webpack bits
Alvin Alexander
@alvinj
Thank you. I watched that, but couldn’t get it to work by following along with the code he showed. But I can try again, maybe there’s something I missed.
Mark Lewis
@MarkCLewis

https://github.com/MarkCLewis/play-scalajs-slinky

@alvinj, this is a repository that I set up for students this semester. It is basically an updated one like for the videos, but with more current versions of everything.

Alvin Alexander
@alvinj
Thanks @MarkCLewis! If I remember right, my initial problem was getting an error like "ReactDOM not found" when I ran fastOptJS, and then as I tried to fix that I kept running into other issues. But that may have just been me working on things late at night. :) Thanks again!
Mark Lewis
@MarkCLewis
@alvinj, makes sense. This project setup, which I am not the original author of, is configured so that you don't need to run fastOptJS. That is automatically run and the result put in the proper place by doing run in sbt and loading a page. I believe you can do client/fastOptJS if you want to specifically compile the Scala.js code as it is all in the client sub-project.
@shadaj:matrix.org, thank you for recommending my playlist. That means a lot.
Alvin Alexander
@alvinj
@MarkCLewis — Thanks again, this is great! For my needs I stripped all of the Play parts out to create a little Slinky “Hello, world” app. I just want a little project I can use to start running and testing some examples.
nafg
@nafg
@shadaj:matrix.org is there a way to automate keeping the g8 repo up to date?
Mark Lewis
@MarkCLewis
@alvinj, yeah, you can use a much simpler setup for that. You really only need the client subproject.
Eric K Richardson
@ekrich
@nafg Scala Steward helps - not automated but.
nafg
@nafg
I saw elsewhere, there's a "hack" to get scala steward to work on g8 repos, if you duplicate deps into the top build then it will detect the updates and then the string replacing logic will find it even in the template project build
Eric K Richardson
@ekrich
Yeah, plus to do this well you have to set it up so you can do CI - not really that much fun. Have you thought of examples in your project? - this is not super easy for a user to use though.
Alexander Weinmann
@lyrx
Hi, is there a way to automatically transform a simple html snippet into a ReactComponent for slinky?
Anything that saves me some typing would be great!!
vonchav
@voonchav_gitlab
Alexander Weinmann
@lyrx
Thanks!
evbo
@evbo

found another intellij hiccup using your example here:
https://github.com/shadaj/slinky/blob/fddd16ab76161c876e2be57171b00d79e6af87dc/docs/src/main/scala/slinky/docs/homepage/TodoApp.scala#L45

The code is fine, but intellij incorrectly says there's an error, expecting TagElement#RefType instead of html.Form for the event type argument to handleSubmit

Alexander Weinmann
@lyrx
Hi guys, I am not really deap into slinky, nor am I a React-Expert in any way. But I chose to use slinky for quite a while now, just to get things done, knowing only as much as I need to use it. Maybe my repo (just a small website) is now clean enough to publish it: https://github.com/lyrx/lyrxp2p . Thanks to slinky and also scalablyped. I would hate doing plain Javascript!!