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

Big Refactoring and adding possibility of className prop #57

Closed

Conversation

lowly2005
Copy link

@lowly2005 lowly2005 commented Sep 17, 2017

Overview:

PR contains component enhancement: possibility to add className for custom css.
It contains also an update of npm modules like react-router , babel, webpack etc. and a refactoring of the example and the main src project

@romainberger If you have any suggestions feel free to poke me

How to use: The readme is updated.

Resolves #36

@lowly2005 lowly2005 changed the title Big Refactoring and adding possibility of className prop Big Refactoring and adding possibility of className prop Issue #36 Sep 17, 2017
@lowly2005 lowly2005 mentioned this pull request Sep 17, 2017
@tanqhnguyen
Copy link
Collaborator

Wow, seems to be a very big one, I will need some time to read through it

@Redmega
Copy link
Collaborator

Redmega commented Sep 19, 2017

PR contains component enhancement: possibility to add className for custom css.

@lowly2005, I don't see this enhancement, only changes to examples.

@Redmega Redmega changed the title Big Refactoring and adding possibility of className prop Issue #36 Big Refactoring and adding possibility of className prop Sep 19, 2017
@lowly2005
Copy link
Author

lowly2005 commented Sep 19, 2017

@Redmega Sorry I just saw that I didn't push some files :s my bad. Now it's OK . I pushed the enhancement.
Thanks @Redmega

style: {style: {}, arrowStyle: {}}
};

const propTypes = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I liked the static props and defaultProps. What was the thought process behind doing it this way?

Copy link
Author

Choose a reason for hiding this comment

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

It keeps the class clean, declaring const propTypes and assign them later to the static properties. + it will be easy to reuse data structures across components.
defaultProps are const because they will not change through the program.

}
Card.defaultProps = defaultProps;
Card.propTypes = propTypes;
export default Card;
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing newline

box-shadow: 0 0 8px rgba(0,0,0,.3);
border-radius: 3px;
z-index: 50;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

newline!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that you have put all the styles into one css file. Maybe we can start doing http://getbem.com/introduction/ while we are at it.

For example, there is one big block ReactPortalTooltip and then ReactPortalTooltip__card

Copy link
Author

Choose a reason for hiding this comment

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

@tanqhnguyen yes it's a good suggestion.

import ListItems from './ListItems'

class Groups extends Component {
constructor(props) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This constructor doesn't do anything, maybe just remove it?

this.showTooltip = this.showTooltip.bind(this);
this.hideTooltip = this.hideTooltip.bind(this);
this.state = {
isTooltipActive: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation is a bit weird here

Copy link
Author

Choose a reason for hiding this comment

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

I'll fix it


var portalNodes = {};

class CardWrapper extends Component {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure how important is it but I think we should name this one Tooltip because it basically replaces the previous Tooltip class

Copy link
Author

Choose a reason for hiding this comment

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

I didn't get it ?!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean in https://github.com/romainberger/react-portal-tooltip/blob/master/src/index.js we have a class called ToolTip which does exactly what your CardWrapper does. Therefore I think we should rename CardWrapper to ToolTip

}
constructor(props) {
super(props);
this.showTooltip = this.showTooltip.bind(this);
Copy link
Collaborator

Choose a reason for hiding this comment

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

the convention is to not have ;

box-shadow: 0 0 8px rgba(0,0,0,.3);
border-radius: 3px;
z-index: 50;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that you have put all the styles into one css file. Maybe we can start doing http://getbem.com/introduction/ while we are at it.

For example, there is one big block ReactPortalTooltip and then ReactPortalTooltip__card

@tanqhnguyen
Copy link
Collaborator

Also, the convention is to not have ;, maybe we should honour that

active: PropTypes.bool,
parentEl: PropTypes.object,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since parentEl is required in the outer component, maybe we should mark it as required here as well?

Copy link
Author

Choose a reason for hiding this comment

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

yes indeed

@romainberger
Copy link
Owner

I'm not sure about moving the style into a css file. In theory I like it, but it means it forces people using the module to have a css loader and to include the node_modules, and that bothers me. I'd rather keep it inline since there's not a lot of style anyway.

@Redmega
Copy link
Collaborator

Redmega commented Mar 27, 2018

Closing as stale. Feel free to update and reopen.

@Redmega Redmega closed this Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants