oyvindberg / st-material-ui

Material UI 5 for Scala 3 (Slinky and Scalajs-React)
32 stars 2 forks source link

How can you do hover on a button? #1

Closed DamianReeves closed 1 year ago

DamianReeves commented 1 year ago

I am getting hot with OutOfMemoryExceptions experimenting with styling as I'm trying to do button hover.

DamianReeves commented 1 year ago

So I bumped up my heap size and started getting errors which basically said I was trying to set properties that didn't exist.

Now I see I can do the following:

  val BlueButton = mui.Button.normal.styled(
    new CSSObject {
      backgroundColor = "skyBlue"
      color = "#888"
      margin = 5
      Colonhover = new CSSObject {
        backgroundColor = "lightblue"
      }
    }
  ).build()

I was trying to do this originally inline with style and CSSProperties but that doesn't seem possible.

Thanks for the really interesting work here BTW.

oyvindberg commented 1 year ago

I'll would more details here. is it sbt that gives you OOM? after much usage? Could be very useful for documentation if it's common

oyvindberg commented 1 year ago

I was trying to do this originally inline with style and CSSProperties but that doesn't seem possible.

I thought style prop would override most other things, but I'm very far from an expert on this. in what way did it not work? If you specify style and open the browser debugging this and inspect the element - do you see the styles applied? but overridden by something?

DamianReeves commented 1 year ago

I'll would more details here. is it sbt that gives you OOM? after much usage? Could be very useful for documentation if it's common

I was using mill as my build tool. and I had been running it in watch mode for a bit.

I had pretty modest JVM settings prior to this:

-Xmx768m
-Xms128m
-Xss8m

But I switched to the following and things started working:

-Xmx5120m
-Xms5120m
-Xss8m
DamianReeves commented 1 year ago

By the way, what portion of the code is meant to be purely generated, and which part can be hand written?

I see some areas where a few well placed extension methods could help make the library easier to work with i.e. such as with media queries like.

const styles = theme => ({
  root: {
    backgroundColor: 'blue',
    [theme.breakpoints.up('md')]: {
      backgroundColor: 'red',
    },
  },
});
oyvindberg commented 1 year ago

99% is generated, src/main/scala-3, while src/main/scala is manually written.

I hope to upstream/generalize most/all of the custom written code i. This repo to ST itself so it can be useful for all libraries instead.

In the meantime we're free to add whatever we want here, so feel free to propose whatever you think is useful :)