CustomizeLayoutOption.jsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { withTranslation } from 'react-i18next';
  4. class CustomizeLayoutOption extends React.Component {
  5. render() {
  6. const { layoutType } = this.props;
  7. return (
  8. <React.Fragment>
  9. <h4>
  10. <div className="custom-control custom-radio">
  11. <input
  12. type="radio"
  13. className="custom-control-input"
  14. id={`radio-layout-${layoutType}`}
  15. checked={this.props.isSelected}
  16. onChange={this.props.onSelected}
  17. />
  18. <label className="custom-control-label" htmlFor={`radio-layout-${layoutType}`}>
  19. {/* eslint-disable-next-line react/no-danger */}
  20. <span dangerouslySetInnerHTML={{ __html: this.props.labelHtml }} />
  21. </label>
  22. </div>
  23. </h4>
  24. <a href={`/images/admin/customize/layout-${layoutType}.gif`} className="ss-container">
  25. <img src={`/images/admin/customize/layout-${layoutType}-thumb.gif`} width="240px" />
  26. </a>
  27. {/* render layout description */}
  28. {this.props.children}
  29. </React.Fragment>
  30. );
  31. }
  32. }
  33. CustomizeLayoutOption.propTypes = {
  34. t: PropTypes.func.isRequired, // i18next
  35. layoutType: PropTypes.string.isRequired,
  36. labelHtml: PropTypes.string.isRequired,
  37. isSelected: PropTypes.bool.isRequired,
  38. onSelected: PropTypes.func.isRequired,
  39. children: PropTypes.array.isRequired,
  40. };
  41. export default withTranslation()(CustomizeLayoutOption);