CustomizeLayoutOption.jsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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="radio radio-primary">
  11. <input type="radio" id={`radio-layout-${layoutType}`} checked={this.props.isSelected} onChange={this.props.onSelected} />
  12. <label htmlFor={`radio-layout-${layoutType}`}>
  13. {/* eslint-disable-next-line react/no-danger */}
  14. <span dangerouslySetInnerHTML={{ __html: this.props.labelHtml }} />
  15. </label>
  16. </div>
  17. </h4>
  18. <a href={`/images/admin/customize/layout-${layoutType}.gif`} className="ss-container">
  19. <img src={`/images/admin/customize/layout-${layoutType}-thumb.gif`} width="240px" />
  20. </a>
  21. {/* render layout description */}
  22. {this.props.children}
  23. </React.Fragment>
  24. );
  25. }
  26. }
  27. CustomizeLayoutOption.propTypes = {
  28. t: PropTypes.func.isRequired, // i18next
  29. layoutType: PropTypes.string.isRequired,
  30. labelHtml: PropTypes.string.isRequired,
  31. isSelected: PropTypes.bool.isRequired,
  32. onSelected: PropTypes.func.isRequired,
  33. children: PropTypes.array.isRequired,
  34. };
  35. export default withTranslation()(CustomizeLayoutOption);