CardPopupCreateContent.jsx 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. disabled={!props.contentName || props.contentName.length === 0}
  45. >
  46. {props.btnValidateLabel}
  47. </button>
  48. </div>
  49. </form>
  50. </div>
  51. </CardPopup>
  52. )
  53. }
  54. PopupCreateContent.propTypes = {
  55. onClose: PropTypes.func.isRequired,
  56. onValidate: PropTypes.func.isRequired,
  57. contentName: PropTypes.string.isRequired,
  58. onChangeContentName: PropTypes.func.isRequired,
  59. label: PropTypes.string,
  60. customColor: PropTypes.string,
  61. faIcon: PropTypes.string,
  62. btnValidateLabel: PropTypes.string,
  63. inputPlaceholder: PropTypes.string
  64. }
  65. PopupCreateContent.defaultProps = {
  66. label: '',
  67. customColor: '#333',
  68. inputPlaceHolder: '',
  69. btnValidateLabel: ''
  70. }
  71. export default Radium(PopupCreateContent)