Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CountryRow.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // @flow
  2. import React, { PureComponent } from 'react';
  3. type Props = {
  4. /**
  5. * Country of the entry.
  6. */
  7. country: { name: string, dialCode: string, code: string },
  8. /**
  9. * Entry click handler.
  10. */
  11. onEntryClick: Function,
  12. };
  13. /**
  14. * This component displays a row from the country picker dropdown.
  15. */
  16. class CountryRow extends PureComponent<Props> {
  17. /**
  18. * Initializes a new {@code CountryRow} instance.
  19. *
  20. * @param {Props} props - The props of the component.
  21. */
  22. constructor(props: Props) {
  23. super(props);
  24. this._onClick = this._onClick.bind(this);
  25. }
  26. /**
  27. * Implements React's {@link Component#render()}.
  28. *
  29. * @inheritdoc
  30. * @returns {ReactElement}
  31. */
  32. render() {
  33. const {
  34. country: { code, dialCode, name }
  35. } = this.props;
  36. return (
  37. <div
  38. className = 'cpick-dropdown-entry'
  39. onClick = { this._onClick }>
  40. <div className = { `prejoin-dialog-flag iti-flag ${code}` } />
  41. <div className = 'cpick-dropdown-entry-text'>
  42. {`${name} (+${dialCode})`}
  43. </div>
  44. </div>
  45. );
  46. }
  47. _onClick: () => void;
  48. /**
  49. * Click handler.
  50. *
  51. * @returns {void}
  52. */
  53. _onClick() {
  54. this.props.onEntryClick(this.props.country);
  55. }
  56. }
  57. export default CountryRow;