您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

CountryIcon.js 899B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. /**
  4. * Implements a React {@link Component} to render a country flag icon.
  5. */
  6. export default class CountryIcon extends Component {
  7. /**
  8. * {@code CountryIcon}'s property types.
  9. *
  10. * @static
  11. */
  12. static propTypes = {
  13. /**
  14. * The css style class name.
  15. */
  16. className: PropTypes.string,
  17. /**
  18. * The 2-letter country code.
  19. */
  20. countryCode: PropTypes.string
  21. };
  22. /**
  23. * Implements React's {@link Component#render()}.
  24. *
  25. * @inheritdoc
  26. * @returns {ReactElement}
  27. */
  28. render() {
  29. const iconClassName
  30. = `flag-icon flag-icon-${
  31. this.props.countryCode} flag-icon-squared ${
  32. this.props.className}`;
  33. return <span className = { iconClassName } />;
  34. }
  35. }