0.2.0 • Published 6 years ago
@alexseitsinger/react-simple-popover v0.2.0
SimplePopover
Extends React.Component
A simple popover element.
Parameters
propsobjectprops.isPopoverVisibleboolean Determines if the popover is visible or not.props.setPopoverVisiblefunction The function to invoke to change the isPopoverVisible value.props.popoverMessagestring The text string to display in the popover.props.popoverStyleobject Extra css styles to apply to the popover. (optional, default{})props.popoverOriginstring The direction that the popover message is displayed from. (optional, defaultright)props.childrenfunction The content to display which triggers a popover.
Examples
import React from "react"
import { connect } from "react-redux"
import { SimplePopover } from "@alexseitsinger/react-simple-popover"
const App = ({ isPopoverVisible, setPopoverVisible, ...props }) => {
return (
<SimplePopover
isPopoverVisible={isPopoverVisible}
setPopoverVisible={setPopoverVisible}
popoverMessage={"This is the text that gets displayed"}>
<div>This is the content that has a popover.</div>
</SimplePopover>
)
}
const mapDispatch = dispatch => ({
setPopoverVisible: bool => dispatch(setPopoverVisible(bool)),
})
const mapState = state => ({
isPopoverVisible: state.app.isPopoverVisible,
})
export default connect(mapState, mapDispatch)(App)Returns function A component.
0.2.0
6 years ago