CardPopupCreateContent.jsx 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import React from 'react'
  2. import PropTypes from 'prop-types'
  3. import Radium from 'radium'
  4. import CardPopup from './CardPopup.jsx'
  5. require('./CardPopupCreateContent.styl')
  6. const PopupCreateContent = props => {
  7. return (
  8. <CardPopup
  9. customClass='popupCreateContent'
  10. customColor={props.customColor}
  11. onClose={props.onClose}
  12. >
  13. <div className='createcontent'>
  14. <div className='createcontent__contentname mb-4'>
  15. <div className='createcontent__contentname__icon ml-1 mr-3'>
  16. <i className={`fa fa-${props.faIcon}`} style={{color: props.customColor}} />
  17. </div>
  18. <div className='createcontent__contentname__title' style={{color: props.customColor}}>
  19. {props.label}
  20. </div>
  21. </div>
  22. <form className='createcontent__form'>
  23. <input
  24. type='text'
  25. className='createcontent__form__input'
  26. placeholder={props.inputPlaceholder}
  27. value={props.contentName}
  28. onChange={props.onChangeContentName}
  29. />
  30. <div className='createcontent__form__button'>
  31. <button
  32. type='button' // do neither remove this nor set it to 'submit' otherwise clicking the btn will submit the form and reload the page
  33. className='createcontent__form__button btn btn-primary'
  34. onClick={props.onValidate}
  35. style={{
  36. backgroundColor: '#fdfdfd',
  37. color: props.customColor,
  38. borderColor: props.customColor,
  39. ':hover': {
  40. backgroundColor: props.customColor,
  41. color: '#fdfdfd'
  42. }
  43. }}
  44. >
  45. {props.btnValidateLabel}
  46. </button>
  47. </div>
  48. </form>
  49. </div>
  50. </CardPopup>
  51. )
  52. }
  53. PopupCreateContent.propTypes = {
  54. onClose: PropTypes.func.isRequired,
  55. onValidate: PropTypes.func.isRequired,
  56. contentName: PropTypes.string.isRequired,
  57. onChangeContentName: PropTypes.func.isRequired,
  58. label: PropTypes.string,
  59. customColor: PropTypes.string,
  60. faIcon: PropTypes.string,
  61. btnValidateLabel: PropTypes.string,
  62. inputPlaceholder: PropTypes.string
  63. }
  64. PopupCreateContent.defaultProps = {
  65. label: '',
  66. customColor: '#333',
  67. inputPlaceHolder: '',
  68. btnValidateLabel: ''
  69. }
  70. export default Radium(PopupCreateContent)