https://linen.dev logo
Join Discord
Powered by
# react
  • a

    ambitious-knife-25690

    01/08/2020, 2:07 PM
    or is it still create a static styles object?
  • u

    user

    01/08/2020, 2:08 PM
    I use jss from material-ui nowadays
  • a

    ambitious-knife-25690

    01/08/2020, 2:08 PM
    i've never heard of jss?
  • u

    user

    01/08/2020, 2:08 PM
    Webpack.require-ing css in a static var should still work
  • u

    user

    01/08/2020, 2:08 PM
    Css in js?
  • a

    ambitious-knife-25690

    01/08/2020, 2:09 PM
    I got that :p Just never knew of it being called JSS
  • u

    user

    01/08/2020, 2:09 PM
    It's one of the many js libs for css in js
  • u

    user

    01/08/2020, 2:09 PM
    They always have a bunch of alternatives
  • u

    user

    01/08/2020, 2:09 PM
    But it's the one used by material-ui, so..
  • a

    ambitious-knife-25690

    01/08/2020, 2:09 PM
    I just found the global static var approach for styling to be a bit clunky especially with no autocompletion
  • u

    user

    01/08/2020, 2:10 PM
    Autocompletion on what?
  • a

    ambitious-knife-25690

    01/08/2020, 2:10 PM
    the styles objects
  • a

    ambitious-knife-25690

    01/08/2020, 2:10 PM
    So better alternatives are highly appreciated 😅
  • u

    user

    01/08/2020, 2:10 PM
    It's not really meant to be used directly, it's just including a css file in your page
  • u

    user

    01/08/2020, 2:11 PM
    Lessie could work with react-next I guess
  • a

    ambitious-knife-25690

    01/08/2020, 2:11 PM
    Oh, so you're going the whole create the styles outside of haxe route I guess?
  • u

    user

    01/08/2020, 2:11 PM
    Yeah, with css or sass or whatever (I used that with one sass file per component), and css classes / ids
  • a

    ambitious-knife-25690

    01/08/2020, 2:11 PM
    When you said jss I thought there may have been a haxe equiv
  • u

    user

    01/08/2020, 2:11 PM
    https://github.com/back2dos/lessie/
  • a

    ambitious-knife-25690

    01/08/2020, 2:13 PM
    aaah
  • a

    ambitious-knife-25690

    01/08/2020, 2:13 PM
    I think i'll probably go the jss route as well then
  • a

    ambitious-knife-25690

    01/08/2020, 2:13 PM
    it should be the most seamless way to utilise the material ui api
  • u

    user

    01/08/2020, 2:13 PM
    That's not how I do jss, it's for the lessie thing I talked about earlier that might work
  • u

    user

    01/08/2020, 2:14 PM
    For jss I do things like that (but in material-ui):
    Copy code
    @:publicProps(MyComponentProps)
    @:wrap(Styles.withStyles(styles))
    class MyComponent extends ReactComponentOfProps<Props> {
      public static function styles(theme:MyTheme):ClassesDef<TClasses> {
        return Styles.jss({
          header: {
            flexShrink: 0,
            color: theme.palette.text.inverted,
            height: 40,
            "@media print": {
              display: "none"
            }
          },
          // ...
        });
      }
    
      // ...
    }
  • u

    user

    01/08/2020, 2:15 PM
    And then
    <div className={props.classes.header} />
  • u

    user

    01/08/2020, 2:18 PM
    I should update this gist: https://gist.github.com/kLabz/20f6e4dece9aa4c256af58514626b66f
  • u

    user

    01/08/2020, 2:19 PM
    Doesn't seem to be too far from current state of material-ui
  • a

    ambitious-knife-25690

    01/08/2020, 2:23 PM
    woah
  • a

    ambitious-knife-25690

    01/08/2020, 2:23 PM
    It has never occurred to me to use
    private
    for typedefs
  • a

    ambitious-knife-25690

    01/08/2020, 2:23 PM
    jesus i'm dumb
1...232425...80Latest