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

The following examples show how to use @fortawesome/free-solid-svg-icons#faPaste. 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: EditTools.tsx    From MagicUI with Apache License 2.0 5 votes vote down vote up
export default function EditTools(props: IEditToolsProps) {
  const cpnState = useSelector((state: IStoreState) => state.component);
  const editToolsState = useSelector((state: IStoreState) => state.editTools);
  const webGLPage = useSelector((state: IStoreState) => state.webGLPage);
  const dispatch = useDispatch();

  const undo = () => {
    dispatch(undoComponent(cpnState.id));
    toast('undo!');
  };

  const del = () => {
    dispatch(deleteComponent(cpnState.id));
    toast('delete!');
  };

  const paste = () => {
    dispatch(pasteComponent(editToolsState.id))
    toast('paste!');
  };

  const copy = () => {
    dispatch(copyComponent(cpnState.id));
    toast('copy!');
  };

  const cut = () => {
    dispatch(copyComponent(cpnState.id));
    dispatch(deleteComponent(cpnState.id));
    toast('cut!');
  };

  const save = () => {
    dispatch(saveComponent())
  };

  return (
    <div className={style.edit_tools}>
      <div className={style.label}>
        EDIT:
      </div>
      <div className={style.tools}>
          <button className={style.save_btn}>
            <FontAwesomeIcon icon={faSave} onClick={save}/>
          </button>
          <button className={style.undo_btn} onClick={undo}>
            <FontAwesomeIcon icon={faUndo}/>
          </button>
          <button className={style.cut_btn} onClick={cut}>
            <FontAwesomeIcon icon={faCut}/>
          </button>
          <button className={style.copy_btn} onClick={copy}>
            <FontAwesomeIcon icon={faCopy}/>
          </button>
          <button className={style.paste_btn} onClick={paste}>
            <FontAwesomeIcon icon={faPaste}/>
          </button>
          <button className={style.trash_btn} onClick={del}>
            <FontAwesomeIcon icon={faTrash}/>
          </button>
      </div>
    </div>
  );
}