-
Notifications
You must be signed in to change notification settings - Fork 7
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
Issue #783 #948
Issue #783 #948
Conversation
IanCStewart
commented
Nov 7, 2017
•
edited by sjaakluthart
Loading
edited by sjaakluthart
- Merge Issue #930 #934 first
Fix tests |
Fix select positioning |
src/portal/index.jsx
Outdated
/* global document */ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { createPortal } from 'react-dom'; // eslint-disable-line import/no-extraneous-dependencies |
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.
You've made react-dome a dependency by importing this here, please install it as such and remove this eslint disable
src/portal/index.jsx
Outdated
class Portal extends React.Component { | ||
static displayName = 'Portal' | ||
|
||
static propTypes = { |
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.
Please define displayName, propTypes and defaultProps outside the Component
src/portal/index.jsx
Outdated
import isFunction from 'lodash/isFunction'; | ||
|
||
/** For transportation of elements to document.body or an element of choice */ | ||
class Portal extends React.Component { |
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.
Please import Component like this
import React, { Component } from 'react';
src/portal/index.jsx
Outdated
/** Content to be portaled */ | ||
children: PropTypes.node.isRequired, | ||
/** Optional node to portal children to */ | ||
node: PropTypes.instanceOf(Object) |
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.
Why would you want this to be optional? It makes more sense to always render it on the bottom of the body tag for example. Also I'm not sure if this default even works since you pass null as default prop...
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 there is no node passed it appends to the bottom of the body. If a user want to append it to say a specific element within his app (say the main tag) it can pass this.
src/select/index.jsx
Outdated
@@ -46,6 +46,8 @@ class Select extends Component { | |||
errorStyle: PropTypes.instanceOf(Object), | |||
/** The header's icon color */ | |||
iconColor: PropTypes.string, | |||
/** Node to portal PopOver to */ | |||
portalNode: PropTypes.instanceOf(Object), |
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.
Same thing goes for this portal prop, what's the use of this?
src/portal/index.jsx
Outdated
const { children, node } = this.props; | ||
|
||
if ( | ||
(!isObject(window) && !window.document && !window.document.createElement) |
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.
Why not this: has(window, 'document.createElement')
src/portal/index.jsx
Outdated
/** Content to be portaled */ | ||
children: PropTypes.node.isRequired, | ||
/** Optional node to portal children to */ | ||
node: PropTypes.instanceOf(Object) |
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.
Why is this instanceOf instead of node?
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.
node breaks when u forward say document.getElementById('root')
. This turns out to be a object not a node
src/portal/index.jsx
Outdated
import isFunction from 'lodash/isFunction'; | ||
|
||
/** For transportation of elements to document.body or an element of choice */ | ||
class Portal extends React.Component { |
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.
Deconstruct Component in the import like we always do: import React, { Component } from 'react';
src/portal/index.jsx
Outdated
@@ -0,0 +1,53 @@ | |||
/* global document */ |
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.
Global document should be added to eslintrc like this:
"globals": {
"document": false,
"global": false,
"navigator": false
},
docs/src/components/select.jsx
Outdated
@@ -1,3 +1,4 @@ | |||
/* global document */ |
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.
Please remove this comment, document isn't used in this file
src/portal/index.jsx
Outdated
render() { | ||
const { children, node } = this.props; | ||
|
||
if ( |
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.
Shouldn't you return children if document
doesn't have createElement
or createPortal
doesn't exist? I'm not sure if your code works like this. Also you can just state has(document, 'createElement')
, no need to check in window
* Issue #848 (#888) * Removed redundant typing message. * Removed redundant import. * Moved iconMenu into message body. * WIP added style to iconMenu for clean messages. * Moved sticker header on top of sticker body. * Added styles for sticker IconMenu. * Moved time on top of images and giphies. * Added styles for compact with new IconMenu placement. * Fixed collapsed styles. Fixes #848. * Fixed tests. * Added test for sticker messages. * Added styles for iconMenu in MessageHeader. * Bumped maxWidth of container to 80%. * Added readability maxWidth to TextMessage. * Issue #806 (#893) * Added menuIcon to Message. * Removed unused styles. * Replaced custom menus with iconMenu prop. * Added styles for iconMenu. * Applied API changes. * Fixed collapsedText. * Adjusted styles to look more like design. * Fixed sticker message styling. * Fixed tests. * Fixed sticker stretching. * Added font scaling for messageTime. * Removed redundant width styling from messageTime. * Fixed tests. * Issue #930 (#934) * Bumped react react-dom and html-react-parser version. * Bumped react and react-dom version. * Fixed all the tests. Fixes #930. * Created default style file to make message styles more dry. Fixes #494. (#949) * Replace dangerouslySetInnerHTML with html-react-parser. Fixes #761. (#951) * Replace dangerouslySetInnerHTML with html-react-parser. Fixes #761. * Removed createMarkup function. * Implemented 8dp grid to AppHeader. (#956) * Issue #751 alert (#955) * Implemented 8dp grid to Alert. * Cleaned-up Alert getStyle. * Reversed test. * Refactored message-list, made ref work again (#961) * Refactored message-list * renamed * Eslint fixes * Replaced emojione.imagePathPNG for emojione.emojiSize. Fixes #725. (#964) * Issue #783 (#948) * Bumped react react-dom and html-react-parser version. * Bumped react and react-dom version. * Fixed all the tests. Fixes #930. * Added react-portal to portal pop-over element to bottom of root. * Added own portal component. * Deconstructed props. * Added doc page about portal component. Fixes #783. * Added example for portal component. * Added description for docs page. * Added description for docs page. * Added alert about react v16. * Made passthrough for portal node prop instead. * Fixed Selects positioning. * Fixed pop-over-position test. * DocGen. * Adjusted in favor of comments. * Fixed broken check. * Changed example. * Changed text. * Cleanup. * Docgen. * Issue #872 (#950) * Added variable middle alignment for when it gets cut of. * Fixed horizontal middle so it actually alligns in the middle. * Added variable middle alignment for when it gets cut off horizontal. * Added 16 margin around the variable placements. * Fixed broken tests. * Added test for offset positioning. Fixes #872. * Removed logging. * Adjusted naming. * Implemented 8dp grid to Banner. (#968) * Implemented 8dp grid to Button. (#969) * Implemented 8dp grid to Card. (#970) * Issue #751 admin badge (#990) * Implemented 8dp grid to AdminBadge. * Fixed linting error. * Fixed broken test. * Implemented 8dp grid to AdminBadge. (#992)