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 882B

1234567891011121314151617181920212223242526272829303132333435363738
  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-${this.props.countryCode
  31. } flag-icon-squared ${this.props.className}`;
  32. return <span className = { iconClassName } />;
  33. }
  34. }