@fortawesome/free-solid-svg-icons#faCommentDots TypeScript Examples

The following examples show how to use @fortawesome/free-solid-svg-icons#faCommentDots. 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: Footer.tsx    From website with MIT License 5 votes vote down vote up
library.add(fab, faCommentDots);
Example #2
Source File: Comment.tsx    From zwo-editor with MIT License 5 votes vote down vote up
Comment = (props: {
  instruction: Instruction;
  durationType: string;
  width: number;
  onChange: Function;
  onClick: Function;  
  index: number;
}) => {
  const timeMultiplier = 3;
  const lengthMultiplier = 10;

  const [time, setTime] = useState(props.instruction.time / timeMultiplier);
  const [isDragging, setIsDragging] = useState(false);

  // FOR RUN WORKOUTS
  const [length, setLength] = useState(
    props.instruction.length / lengthMultiplier
  );

  function handleTouch(position: number) {

    setIsDragging(false);

    if(isDragging){
      props.onChange(props.instruction.id, {
        id: props.instruction.id,      
        time: position * timeMultiplier,
        length: position * lengthMultiplier,
        text: props.instruction.text,      
      });
    }else{
      props.onClick(props.instruction.id)
    }    
  }

  function handleDragging(position: number) {    
    setIsDragging(true);
    setTime(position);
    setLength(position);
  }

  return (
    <Draggable
      axis="x"
      handle=".handle"
      defaultPosition={{ x: time, y: (props.index % 5) * 20 }}
      bounds={{ left: 0, right: props.width }}
      scale={1}
      onStop={(e, data) => handleTouch(data.x)}
      onDrag={(e, data) => handleDragging(data.x)}      
    >
      <div>
        <FontAwesomeIcon
          style={{ display: "block", opacity: 0.7 }}
          icon={props.instruction.text !== "" ? faCommentDots : faComment}
          size="lg"
          fixedWidth
          className="handle"
        />
        {isDragging && (
          <div className="edit">
            {props.durationType === "time" ? (
              <span style={{ fontSize: "13px" }} data-testid="time">
                {helpers.formatDuration(time * timeMultiplier)}
              </span>
            ) : (
              <span style={{ fontSize: "13px" }} data-testid="time">
                {length * lengthMultiplier} m
              </span>
            )}
          </div>
        )}
        <div className="line"></div>
      </div>
    </Draggable>
  );
}