-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Feature/styled components #24
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @dejankocev !
Found only one broken style - see in the comments.
Otherwise just minor nits:
Would be nice to get rid of the console warning that appears in two places.
Also added a few suggestions for adding more precise types.
The linter complains about single quote use in the imports. This should also be fixed.
|
||
//types | ||
type SortIconContainerType = { | ||
item: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the item
field be boolean
like the container
is or were there any issues with that?
fullWidth: boolean; | ||
disableRipple: boolean; | ||
size: string; | ||
onClick: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, let's add a more specific () => void
instead of any
.
|
||
//type | ||
type StyledGridType = { | ||
container: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean
, if possible
type SnackbarType = { | ||
open: boolean; | ||
autoHideDuration: number; | ||
onClose: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add the () => void
type if possible.
} | ||
|
||
export const ListItem = styled($ListItem)<ListItemType>` | ||
${p => p.isDisabled && ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there's a console error in dev mode.
Warning: React does not recognize the
isDisabled
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercaseisdisabled
instead. If you accidentally passed it from a parent component, remove it from the DOM element.
Not sure if it's necessary to add it to the DOM but if it's ok and there's no other good workaround, I suggest changing it to disabled
instead.
`; | ||
|
||
export const SortOptionActiveGrid = styled(Grid)<SortOptionActiveGridType>` | ||
${p => p.sortOptionActive && ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A similar warning appears as described here.
|
||
const getArrowIconStyles = (p: any) => { | ||
return ` | ||
font-size: ${p.theme.typography.body2.fontSize}px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that the body2.fontSize
value already includes a unit, so that currently it appears as font-size: 0.875rempx;
and breaks the style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code-wise looks good.
Remaining issues:
- I would suggest adding types where possible.
- The console warnings for isDisabled and sortOptionActive still persist.
- The linter error needs fixing.
Also, a new thing is that the dark theme and drawer menu width seem to not get fully applied, and the disconnect
button is misplaced:
} | ||
|
||
type AddressFieldType = { | ||
fullWidth: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer to give as many exact types as possible. I guess here at least fullWidth: boolean
and value: string
would make sense.
Introducing styled-components and updating project structure and components according to it