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.

AudioSettingsEntry.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // @flow
  2. import React from 'react';
  3. import { Icon, IconCheck, IconExclamationSolid } from '../../../../base/icons';
  4. /**
  5. * The type of the React {@code Component} props of {@link AudioSettingsEntry}.
  6. */
  7. export type Props = {
  8. /**
  9. * The text for this component.
  10. */
  11. children: React$Node,
  12. /**
  13. * Flag indicating an error.
  14. */
  15. hasError?: boolean,
  16. /**
  17. * The id for the label, that contains the item text.
  18. */
  19. labelId?: string,
  20. /**
  21. * Flag indicating the selection state.
  22. */
  23. isSelected: boolean,
  24. };
  25. /**
  26. * React {@code Component} representing an entry for the audio settings.
  27. *
  28. * @returns { ReactElement}
  29. */
  30. export default function AudioSettingsEntry(
  31. { children, hasError, labelId, isSelected }: Props) {
  32. const className = `audio-preview-entry ${isSelected
  33. ? 'audio-preview-entry--selected' : ''}`;
  34. return (
  35. <div className = { className }>
  36. {isSelected && (
  37. <Icon
  38. className = 'audio-preview-icon audio-preview-icon--check'
  39. color = '#1C2025'
  40. size = { 14 }
  41. src = { IconCheck } />
  42. )}
  43. <span
  44. className = 'audio-preview-entry-text'
  45. id = { labelId }>
  46. {children}
  47. </span>
  48. {hasError && <Icon
  49. className = 'audio-preview-icon audio-preview-icon--exclamation'
  50. size = { 16 }
  51. src = { IconExclamationSolid } />}
  52. </div>
  53. );
  54. }