react-icons/ai#AiOutlineFontSize TypeScript Examples

The following examples show how to use react-icons/ai#AiOutlineFontSize. 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: Edit.tsx    From Notepad with MIT License 4 votes vote down vote up
function Edit() {
  const [showEdit, setShowEdit] = useState(false);
  const { drawMode } = useContext(DrawModeContext);
  const { drawPadRef } = useContext(DrawPadRefContext);
  const { alertBox, setAlertBox } = useContext(AlertBoxContext);
  const fontChangesRef = useRef<{ handleOkClick(): void }>();

  const handleFontClick = () => {
    !alertBox
      ? setAlertBox({
          title: "Font",
          body: <ChangeFontBody fontChangesRef={fontChangesRef} />,
          buttons: [
            {
              text: "Cancel",
              onClick: () => setAlertBox(null),
            },
            {
              text: "Ok",
              onClick: () => {
                fontChangesRef.current?.handleOkClick();
                setAlertBox(null);
              },
            },
          ],
        })
      : setAlertBox(null);
  };

  return (
    <div className="dropdown">
      <button
        className="btn"
        onClick={() => setShowEdit(!showEdit)}
        onBlur={() => setTimeout(() => setShowEdit(false), 150)}
      >
        Edit
      </button>
      <div
        className="dropdown-content"
        style={{ display: showEdit ? "block" : "none" }}
      >
        {drawMode ? (
          <>
            <button className="menu-btn btn" onClick={drawPadRef?.undo}>
              Undo <kbd>Ctrl + Z</kbd>
            </button>
            <hr />

            <button className="menu-btn btn" onClick={drawPadRef?.clear}>
              Clear <kbd>Ctrl + Y</kbd>
            </button>
            <button className="menu-btn btn" onClick={drawPadRef?.eraseAll}>
              Erase all{" "}
              <kbd>
                <AiFillDelete />
              </kbd>
            </button>
          </>
        ) : (
          <>
            <button className="menu-btn btn">
              Undo <kbd>Ctrl + Z</kbd>
            </button>
            <hr />

            <button className="menu-btn btn">
              Cut <kbd>Ctrl + X</kbd>
            </button>
            <button className="menu-btn btn">
              Copy <kbd>Ctrl + C</kbd>
            </button>
            <button className="menu-btn btn">
              Paste <kbd>Ctrl + P</kbd>
            </button>
            <button className="menu-btn btn">
              Delete <kbd>Del</kbd>
            </button>
            <hr />

            <button className="menu-btn btn">
              Find <kbd>Ctrl + F</kbd>
            </button>
            <button className="menu-btn btn">
              Go to <kbd>Ctrl + G</kbd>
            </button>
            <hr />

            <button
              className="menu-btn btn"
              onClick={() =>
                selectAllOfInput(
                  document.getElementById("text-area") as HTMLTextAreaElement
                )
              }
            >
              Select All <kbd>Ctrl + A</kbd>
            </button>
            <button
              className="menu-btn btn"
              onClick={() => {
                insertTimeAndDate(
                  document.getElementById("text-area") as HTMLTextAreaElement
                );
              }}
            >
              Time/Date <kbd>F5</kbd>
            </button>
            <hr />

            <button className="menu-btn btn" onClick={handleFontClick}>
              Font{" "}
              <p>
                <AiOutlineFontSize />
              </p>
            </button>
          </>
        )}
      </div>
    </div>
  );
}