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

Issue #783 #948

Merged
merged 24 commits into from
Nov 13, 2017
Merged

Issue #783 #948

merged 24 commits into from
Nov 13, 2017

Conversation

IanCStewart
Copy link
Contributor

@IanCStewart IanCStewart commented Nov 7, 2017

@IanCStewart
Copy link
Contributor Author

Fix tests

@IanCStewart
Copy link
Contributor Author

IanCStewart commented Nov 8, 2017

Fix select positioning

/* global document */
import React from 'react';
import PropTypes from 'prop-types';
import { createPortal } from 'react-dom'; // eslint-disable-line import/no-extraneous-dependencies
Copy link
Contributor

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

class Portal extends React.Component {
static displayName = 'Portal'

static propTypes = {
Copy link
Contributor

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

import isFunction from 'lodash/isFunction';

/** For transportation of elements to document.body or an element of choice */
class Portal extends React.Component {
Copy link
Contributor

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';

/** Content to be portaled */
children: PropTypes.node.isRequired,
/** Optional node to portal children to */
node: PropTypes.instanceOf(Object)
Copy link
Contributor

@sjaakluthart sjaakluthart Nov 8, 2017

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...

Copy link
Contributor Author

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.

sjaakluthart
sjaakluthart previously approved these changes Nov 8, 2017
@@ -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),
Copy link
Contributor

@sjaakluthart sjaakluthart Nov 8, 2017

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?

const { children, node } = this.props;

if (
(!isObject(window) && !window.document && !window.document.createElement)
Copy link
Contributor

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')

/** Content to be portaled */
children: PropTypes.node.isRequired,
/** Optional node to portal children to */
node: PropTypes.instanceOf(Object)
Copy link
Contributor

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?

Copy link
Contributor Author

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

import isFunction from 'lodash/isFunction';

/** For transportation of elements to document.body or an element of choice */
class Portal extends React.Component {
Copy link
Contributor

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';

@@ -0,0 +1,53 @@
/* global document */
Copy link
Contributor

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
  },

@sjaakluthart sjaakluthart dismissed their stale review November 8, 2017 09:10

I meant to request changes

@@ -1,3 +1,4 @@
/* global document */
Copy link
Contributor

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

render() {
const { children, node } = this.props;

if (
Copy link
Contributor

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

@IanCStewart IanCStewart dismissed stale reviews from sjaakluthart and larstadema November 8, 2017 17:52

fixed

@larstadema larstadema merged commit 91cd977 into v5.0.0 Nov 13, 2017
@larstadema larstadema deleted the issue-#783 branch November 13, 2017 12:41
IanCStewart added a commit that referenced this pull request Dec 12, 2017
* 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)
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.

3 participants