kotlin-wrappers icon indicating copy to clipboard operation
kotlin-wrappers copied to clipboard

How to set MUI breakpoint values

Open dosier opened this issue 3 years ago • 5 comments

Hi, I am trying to convert the following code:

<Grid container spacing={3}>
  <Grid xs="auto">
    <Item>variable width content</Item>
  </Grid>
  <Grid xs={6}>
    <Item>xs=6</Item>
  </Grid>
  <Grid xs>
    <Item>xs</Item>
  </Grid>
</Grid> 

to Kotlin using kotlin-mui.

The issue I am having is that I don't know how to set the value for the xs breakpoint.

dosier avatar Nov 18 '22 13:11 dosier

WA

inline var GridProps.xs: Any?
    get() = asDynamic().xs
    set(value) = asDynamic().xs = value

turansky avatar Nov 18 '22 20:11 turansky

Get the following error when I try the above

Assignments are not expressions, and only expressions are allowed in this context

This works though

inline var GridProps.xs: Any?
    get() = asDynamic().xs
    set(value) {
        asDynamic().xs = value
    }

mattdornfeld avatar Jul 02 '23 20:07 mattdornfeld

I have these extensions now for GridProps

inline var GridProps.xs: Int
    get() = throw NotImplementedError("Prop is write-only!")
    set(value) {
        asDynamic().xs = value
    }

inline var GridProps.justifyContent: String
    get() = throw NotImplementedError("Prop is write-only!")
    set(value) {
        asDynamic().justifyContent = value
    }

inline var GridProps.alignItems: String
    get() = throw NotImplementedError("Prop is write-only!")
    set(value) {
        asDynamic().alignItems = value
  

ArjenKellerICS avatar Jul 10 '23 13:07 ArjenKellerICS

Expected extensions:

inline var GridProps.justifyContent: JustifyContent
    get() = asDynamic().justifyContent
    set(value) {
        asDynamic().justifyContent = value
    }

inline var GridProps.alignItems: AlignItems
    get() = asDynamic().alignItems
    set(value) {
        asDynamic().alignItems = value

turansky avatar Jul 10 '23 18:07 turansky

Is there a plan to include these extensions in the library?

shubhamsinghshubham777 avatar Oct 26 '23 02:10 shubhamsinghshubham777