This repository has been archived by the owner on Aug 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from dannyrb/fix/render-component-prop-docs
Fix/render component prop docs
- Loading branch information
Showing
94 changed files
with
1,616 additions
and
1,604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
"proseWrap": "always", | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true | ||
"singleQuote": true, | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,74 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, { Component } from 'react'; | ||
import { DropTarget } from 'react-dnd'; | ||
import './LayoutPanelDropTarget.css'; | ||
import PropTypes from 'prop-types' | ||
import React, { Component } from 'react' | ||
import { DropTarget } from 'react-dnd' | ||
import './LayoutPanelDropTarget.css' | ||
|
||
// Drag sources and drop targets only interact | ||
// if they have the same string type. | ||
const Types = { | ||
THUMBNAIL: 'thumbnail' | ||
}; | ||
THUMBNAIL: 'thumbnail', | ||
} | ||
|
||
const divTarget = { | ||
drop(props, monitor, component) { | ||
const item = monitor.getItem(); | ||
const item = monitor.getItem() | ||
|
||
if (props.onDrop) { | ||
props.onDrop({ | ||
viewportIndex: props.viewportIndex, | ||
item | ||
}); | ||
item, | ||
}) | ||
} | ||
|
||
return { | ||
id: `LayoutPanelDropTarget-${props.viewportIndex}`, | ||
viewportIndex: props.viewportIndex, | ||
item | ||
}; | ||
} | ||
}; | ||
item, | ||
} | ||
}, | ||
} | ||
|
||
// TODO: Find out why we can't move this into the Example app instead. | ||
// It looks like the context isn't properly shared. | ||
class LayoutPanelDropTarget extends Component { | ||
static className = 'LayoutPanelDropTarget'; | ||
static className = 'LayoutPanelDropTarget' | ||
|
||
static defaultProps = { | ||
isOver: false, | ||
canDrop: false | ||
}; | ||
canDrop: false, | ||
} | ||
|
||
static propTypes = { | ||
connectDropTarget: PropTypes.func.isRequired, | ||
canDrop: PropTypes.bool.isRequired, | ||
isOver: PropTypes.bool.isRequired, | ||
viewportComponent: PropTypes.object | ||
}; | ||
viewportComponent: PropTypes.object, | ||
} | ||
|
||
render() { | ||
const { canDrop, isOver, connectDropTarget } = this.props; | ||
const isActive = canDrop && isOver; | ||
const { canDrop, isOver, connectDropTarget } = this.props | ||
const isActive = canDrop && isOver | ||
|
||
let className = LayoutPanelDropTarget.className; | ||
let className = LayoutPanelDropTarget.className | ||
|
||
if (isActive) { | ||
className += ' hovered'; | ||
className += ' hovered' | ||
} else if (canDrop) { | ||
className += ' can-drop'; | ||
className += ' can-drop' | ||
} | ||
|
||
return connectDropTarget( | ||
<div className={className}>{this.props.children}</div> | ||
); | ||
) | ||
} | ||
} | ||
|
||
const collect = (connect, monitor) => ({ | ||
connectDropTarget: connect.dropTarget(), | ||
canDrop: monitor.canDrop(), | ||
isOver: monitor.isOver() | ||
}); | ||
isOver: monitor.isOver(), | ||
}) | ||
|
||
export default DropTarget(Types.THUMBNAIL, divTarget, collect)( | ||
LayoutPanelDropTarget | ||
); | ||
) |
Oops, something went wrong.