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

CountryIcon.js 861B

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