From 36178adc076960ff80ced840dfa19e89566f2afd Mon Sep 17 00:00:00 2001 From: raboid Date: Mon, 7 Jan 2019 17:19:24 -0500 Subject: [PATCH] Create Popout component --- components/Popout.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 components/Popout.js diff --git a/components/Popout.js b/components/Popout.js new file mode 100644 index 0000000..c1334cd --- /dev/null +++ b/components/Popout.js @@ -0,0 +1,44 @@ +import React from 'react' +import enhanceWithClickOutside from 'react-click-outside' + +import WindowPointer from './WindowPointer' +import { COLORS } from '../lib/constants' + +class Popout extends React.PureComponent { + static defaultProps = { + borderColor: COLORS.SECONDARY, + style: {}, + onClickOutside: () => {} + } + + handleClickOutside = e => !this.props.hidden && this.props.onClickOutside(e) + + render() { + const { children, borderColor, style, hidden, pointerLeft, pointerRight } = this.props + + if (hidden) { + return null + } + + return ( +
+ + {children} + +
+ ) + } +} + +export default enhanceWithClickOutside(Popout)