You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CountryIcon.js 858B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React, { Component } from 'react';
  2. /**
  3. * Implements a React {@link Component} to render a country flag icon.
  4. */
  5. export default 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. }