You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repository and believe that this is not a duplicate.
Summary 馃挕
The main reason that blocking me to adopt styled component is that I have to write things like this:
constStyledDialogActions=styled(DialogActions)(({ theme })=>({[`&.${dialogActionsClasses.root}>:not(:first-of-type)`]: {marginLeft: theme.spacing(3),},[`&.${dialogActionsClasses.spacing}`]: {// some style}}))
It's would be better to have an API like this:
constStyledDialogActions=styled(DialogActions)({root: theme=>{"&>:not(:first-of-type)": {marginLeft: theme.spacing(3)}},spacing: {},// some styleextra: {}// Type Error!})
Motivation 馃敠
It's cleaner and much type-safe. Please consider this.
Here is my idea in TypeScript
import{Dialog,Theme}from'@material-ui/core'declarefunctionstyled<T,Qextendsobject>(comp: React.ComponentType<T&{classes?: Partial<Q>}>): (styles: Record<keyofQ,React.CSSProperties|((theme: Theme)=>React.CSSProperties)>)=>React.ComponentType<T>constStyledDialog=styled(Dialog)({root: {color: 'red',},container: (theme)=>({marginTop: theme.spacing(1)}),// Object literal may only specify known properties, and 'thisOne' does not exist in type 'Record<keyof DialogClasses, CSSProperties | ((theme: Theme) => CSSProperties)>'.// ts error 2345thisOne: {},})
The text was updated successfully, but these errors were encountered:
Summary 馃挕
The main reason that blocking me to adopt styled component is that I have to write things like this:
It's would be better to have an API like this:
Motivation 馃敠
It's cleaner and much type-safe. Please consider this.
Here is my idea in TypeScript
The text was updated successfully, but these errors were encountered: