UNPKG

@coreui/react

Version:

CoreUI React 17 Bootstrap 4 components

39 lines (31 loc) 862 B
import React, { useContext } from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' import { Context } from './CSidebar' //component - CoreUI / CSidebarMinimizer const CSidebarMinimizer = props => { const { className, // innerRef, ...attributes } = props const { toggleMinimize } = useContext(Context) //render const classes = classNames('c-sidebar-minimizer', className) return ( <button className={classes} type="button" {...attributes} onClick={toggleMinimize} ref={innerRef} /> ) } CSidebarMinimizer.propTypes = { className: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]), // innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]), }; export default CSidebarMinimizer