2020-03-30 14:17:18 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { Icon, IconCheck, IconExclamationSolid } from '../../../../base/icons';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link AudioSettingsEntry}.
|
|
|
|
*/
|
|
|
|
export type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The text for this component.
|
|
|
|
*/
|
|
|
|
children: React$Node,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag indicating an error.
|
|
|
|
*/
|
|
|
|
hasError?: boolean,
|
|
|
|
|
2021-06-10 12:48:44 +00:00
|
|
|
/**
|
|
|
|
* The id for the label, that contains the item text.
|
|
|
|
*/
|
|
|
|
labelId?: string,
|
|
|
|
|
2020-03-30 14:17:18 +00:00
|
|
|
/**
|
|
|
|
* Flag indicating the selection state.
|
|
|
|
*/
|
|
|
|
isSelected: boolean,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* React {@code Component} representing an entry for the audio settings.
|
|
|
|
*
|
|
|
|
* @returns { ReactElement}
|
|
|
|
*/
|
2021-06-10 12:48:44 +00:00
|
|
|
export default function AudioSettingsEntry(
|
|
|
|
{ children, hasError, labelId, isSelected }: Props) {
|
|
|
|
|
2020-03-30 14:17:18 +00:00
|
|
|
const className = `audio-preview-entry ${isSelected
|
|
|
|
? 'audio-preview-entry--selected' : ''}`;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className = { className }>
|
|
|
|
{isSelected && (
|
|
|
|
<Icon
|
|
|
|
className = 'audio-preview-icon audio-preview-icon--check'
|
|
|
|
color = '#1C2025'
|
|
|
|
size = { 14 }
|
|
|
|
src = { IconCheck } />
|
|
|
|
)}
|
2021-06-10 12:48:44 +00:00
|
|
|
<span
|
|
|
|
className = 'audio-preview-entry-text'
|
|
|
|
id = { labelId }>
|
|
|
|
{children}
|
|
|
|
</span>
|
2020-03-30 14:17:18 +00:00
|
|
|
{hasError && <Icon
|
|
|
|
className = 'audio-preview-icon audio-preview-icon--exclamation'
|
|
|
|
size = { 16 }
|
|
|
|
src = { IconExclamationSolid } />}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|