PageWrapper.jsx 1011B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react'
  2. import PropTypes from 'prop-types'
  3. import classnames from 'classnames'
  4. import PageTitle from './PageTitle.jsx'
  5. import PageContent from './PageContent.jsx'
  6. const PageWrapper = props => {
  7. return (
  8. <div className={classnames(props.customeClass, 'pageWrapperGeneric')}>
  9. <div className='container-fluid'>
  10. <div className='row'>
  11. {props.children}
  12. </div>
  13. </div>
  14. </div>
  15. )
  16. }
  17. export default PageWrapper
  18. PageWrapper.propTypes = {
  19. customClass: PropTypes.string,
  20. children: PropTypes.arrayOf((children, key, componentName /* , location, propFullName */) => {
  21. if (
  22. children.length > 2 ||
  23. children[0].type !== PageTitle ||
  24. children[1].type !== PageContent
  25. // children.some(p => p.type !== CardHeader && p.type !== CardBody)
  26. ) {
  27. return new Error(`PropType Error: childrens of ${componentName} must be: 1 PageTitle and 1 PageContent.`)
  28. }
  29. }).isRequired
  30. }
  31. PageWrapper.defaultProps = {
  32. customClass: ''
  33. }