react-icons/fa#FaRegEdit JavaScript Examples

The following examples show how to use react-icons/fa#FaRegEdit. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Note.js    From aws-amplify-quick-notes with MIT No Attribution 5 votes vote down vote up
NotesComponent = props => {
  const [showEditor, setShowEditor] = useState(false);

  const playAudio = async () => {
    const result = await Predictions.convert({
      textToSpeech: {
        source: {
          text: props.text
        }
      }
    });

    const audioCtx = new AudioContext();
    const source = audioCtx.createBufferSource();

    audioCtx.decodeAudioData(
      result.audioStream,
      buffer => {
        source.buffer = buffer;
        source.connect(audioCtx.destination);
        source.start(0);
      },
      error => console.log(error)
    );
  };

  return (
    <Note>
      <Info>
        <Title>{props.title}</Title>
        <Text>{props.text}</Text>
      </Info>
      <Divider />
      <NoteActions>
        <Icon onClick={() => playAudio()}>
          <FaPlay />
        </Icon>
        <Icon onClick={() => setShowEditor(true)}>
          <FaRegEdit />
        </Icon>
        <Icon>
          <FaRegTrashAlt onClick={props.onDelete} />
        </Icon>
      </NoteActions>

      {showEditor && (
        <RecordingEditor
          title={props.title}
          text={props.text}
          onDismiss={() => {
            setShowEditor(false);
          }}
          onSave={props.onSaveChanges}
        />
      )}
    </Note>
  );
}