Fork me on GitHub
#clojurescript
<
2018-07-07
>
Marcin11:07:25

Hey, one question about props. In Material UI there’s something like composition

<GridList className={classes.gridList} cols={2.5}>
        {tileData.map(tile => (
          <GridListTile key={tile.img}>
            <img src={tile.img} alt={tile.title} />
            <GridListTileBar
              title={tile.title}
              classes={{
                root: classes.titleBar,
                title: classes.title,
              }}
              actionIcon={
                <IconButton>
                  <StarBorderIcon className={classes.title} />
                </IconButton>
              }
            />
          </GridListTile>
        ))}
      </GridList>
So here GridListTile needs to be under GridList. I’ve trying to move GridListTile to a wrapper component, but then I’d need to pass the this.props.style to keep the styling, like this
<GridListTile cols={1} style={{...this.props.style, background: 'green'}} onClick={this.handleClick}>
        {this.props.id}
      </GridListTile>
Is there any common way of doing so in Reagent Cljs?

Marcin21:07:27

Thank you. Can you give me an idea how to connect these?

[:> GridList {:cell-height 180 :cols 3}
          (for [image @images]
            (let [image-key (get-in image [:details :id])]
              ^{:key image-key} 
                (m/let [classes ...?]
                    [grild-tile image])))]
I’m probably suppose to get these styles here, but not sure how. Cheers!

souenzzo00:07:26

i think that it's ok. But I would try to put the m/let before the for

Marcin09:07:03

@U2J4FRT2T and how can I extract props.style from it? theme.props seem to be empty

Marcin13:07:59

ok, nvm I’ve just did it myself 😉

👍 4
souenzzo14:07:48

please share 🙂 I'm still not using it. ATM Trying #fulcro again

Marcin18:07:21

By myself I mean, with sass for the time being. In a moment I'll figure it out and post it here :)

👍 4
eoliphant23:07:03

anyone know of a clj-js alternative that maintains namespaces? Like cheshire does for clojure

Roman Liutikov13:07:06

You can do it by providing custom keyword-fn (clj->js {:user/email ""} :keyword-fn #(str (namespace %) "/" (name %)))

Roman Liutikov16:07:45

I wouldn’t rely on implementation detail to save a couple of characters.

👍 4