Skip to content
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

[#1] Replace MUI Drawer component with own implementation #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

orlovmaxxim
Copy link
Collaborator

No description provided.

@orlovmaxxim orlovmaxxim requested a review from andrew--r March 20, 2018 09:41
}
}

getDrawerClassName = () => classNames(styles.dragArea);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this method is never used

transition: 'opacity .3s ease-out, visibility .3s ease-out',
backgroundColor: 'rgba(0,0,0,.54)',
},
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these styles are inlined in JS? Why not to place them at CSS file?


constructor(props) {
super(props);
this.state = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tip: you could define initial state without using the constructor

class Drawer extends React.Component {
  state = {
    touchId: null,
    /* ... */
  };
}

startY: null,
currentX: null,
currentY: null,
sidebarWidth: 256,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value doesn't change, so it shouldn't be in state, it's more like a constant.

And I see that it's duplicated in styles. Maybe it's better to set ref on a drawer node and get width from it when neccessary:

class Drawer extends React.Component {
  getSidebarWidth = () => this.drawerNode.clientWidth;
}

}

.drawer {
color: rgba(0, 0, 0, 0.87);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are mixed tabs and spaces. Consider using EditorConfig plugin for your text editor to prevent this kind of issues

font-family: Roboto, sans-serif;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 10px, rgba(0, 0, 0, 0.23) 0px 3px 10px;
border-radius: 0px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it's needed to reset border-radius, shouldn't it be 0 by default?

@@ -0,0 +1,23 @@
.drawernone {
display: block;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this class doesn't change anything because div has display: block by default

const drawer = classNames({
[`${styles.drawer}`]: true,
});
const dragHandle = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used only once, so it don't have to be stored in a variable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also currently dragHandle overlaps menu icon, so only a part of this icon is clickable:

screen shot 2018-03-24 at 13 05 45

@@ -141,10 +143,8 @@ const EventPage = React.createClass({
return (
<Drawer
onRequestChange={(menuOpen) => this.setState({ menuOpen })}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be better to split onRequestChange to two props: onOpen and onClose. Currently onRequestChange accepts a function with a single boolean argument, that's a bad practice (and that's MUI fault, not yours)


getDrawerClassName = () => classNames(styles.dragArea);

overlayClick = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest renaming overlayClick to handleOverlayClick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants