From 722e5ca845b1c64219201d0c7a0b4e301acdf5d2 Mon Sep 17 00:00:00 2001 From: Lipis Date: Mon, 29 Mar 2021 17:09:20 +0300 Subject: [PATCH] refactor: Use arrow function where possible (#3315) --- src/actions/actionCanvas.tsx | 2 +- src/actions/actionExport.tsx | 2 +- src/components/Actions.tsx | 2 +- src/components/ButtonIconCycle.tsx | 5 ++--- src/components/CollabButton.tsx | 2 +- src/components/Dialog.tsx | 2 +- src/components/ExportDialog.tsx | 2 +- src/components/LayerUI.tsx | 2 +- src/components/LibraryUnit.tsx | 2 +- src/components/Stats.tsx | 2 +- src/excalidraw-app/index.tsx | 10 ++++++---- src/is-mobile.tsx | 5 +---- src/renderer/renderElement.ts | 6 +++--- src/tests/resize.test.tsx | 6 +++--- 14 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/actions/actionCanvas.tsx b/src/actions/actionCanvas.tsx index 9f23ef04..47b090b8 100644 --- a/src/actions/actionCanvas.tsx +++ b/src/actions/actionCanvas.tsx @@ -8,7 +8,7 @@ import { getCommonBounds, getNonDeletedElements } from "../element"; import { newElementWith } from "../element/mutateElement"; import { ExcalidrawElement } from "../element/types"; import { t } from "../i18n"; -import useIsMobile from "../is-mobile"; +import { useIsMobile } from "../is-mobile"; import { CODES, KEYS } from "../keys"; import { getNormalizedZoom, getSelectedElements } from "../scene"; import { centerScrollOn } from "../scene/scroll"; diff --git a/src/actions/actionExport.tsx b/src/actions/actionExport.tsx index 7d5f2287..04f3a2aa 100644 --- a/src/actions/actionExport.tsx +++ b/src/actions/actionExport.tsx @@ -8,7 +8,7 @@ import { Tooltip } from "../components/Tooltip"; import { DarkModeToggle, Appearence } from "../components/DarkModeToggle"; import { loadFromJSON, saveAsJSON } from "../data"; import { t } from "../i18n"; -import useIsMobile from "../is-mobile"; +import { useIsMobile } from "../is-mobile"; import { KEYS } from "../keys"; import { register } from "./register"; import { supported } from "browser-fs-access"; diff --git a/src/components/Actions.tsx b/src/components/Actions.tsx index 03ecd51a..3aac0133 100644 --- a/src/components/Actions.tsx +++ b/src/components/Actions.tsx @@ -3,7 +3,7 @@ import { ActionManager } from "../actions/manager"; import { getNonDeletedElements } from "../element"; import { ExcalidrawElement } from "../element/types"; import { t } from "../i18n"; -import useIsMobile from "../is-mobile"; +import { useIsMobile } from "../is-mobile"; import { canChangeSharpness, canHaveArrowheads, diff --git a/src/components/ButtonIconCycle.tsx b/src/components/ButtonIconCycle.tsx index 1159a1f4..98a6aa8a 100644 --- a/src/components/ButtonIconCycle.tsx +++ b/src/components/ButtonIconCycle.tsx @@ -1,4 +1,3 @@ -import React from "react"; import clsx from "clsx"; export const ButtonIconCycle = ({ @@ -14,11 +13,11 @@ export const ButtonIconCycle = ({ }) => { const current = options.find((op) => op.value === value); - function cycle() { + const cycle = () => { const index = options.indexOf(current!); const next = (index + 1) % options.length; onChange(options[next].value); - } + }; return (