diff --git a/src/components/Gitako.tsx b/src/components/Gitako.tsx
index 2ce5d1a..a3baf50 100644
--- a/src/components/Gitako.tsx
+++ b/src/components/Gitako.tsx
@@ -2,7 +2,7 @@ import { SideBar } from 'components/SideBar'
import { ConfigsContextWrapper } from 'containers/ConfigsContext'
import { InspectorContextWrapper } from 'containers/Inspector'
import { ReloadContextWrapper } from 'containers/ReloadContext'
-import * as React from 'react'
+import React, { useMemo } from 'react'
import { StyleSheetManager } from 'styled-components'
import { insertMountPoint } from 'utils/DOMHelper'
import { ErrorBoundary } from '../containers/ErrorBoundary'
@@ -12,7 +12,7 @@ import { RepoContextWrapper } from '../containers/RepoContext'
import { StateBarStateContextWrapper } from '../containers/SideBarState'
export function Gitako() {
- const mountPoint = React.useMemo(() => insertMountPoint(), [])
+ const mountPoint = useMemo(() => insertMountPoint(), [])
return (
diff --git a/src/components/Highlight.tsx b/src/components/Highlight.tsx
index 243994e..bd27957 100644
--- a/src/components/Highlight.tsx
+++ b/src/components/Highlight.tsx
@@ -1,8 +1,8 @@
-import * as React from 'react'
+import React, { useMemo } from 'react'
import { getIsSupportedRegex } from './searchModes/regexMode'
export const Highlight = function Highlight({ text, match }: { text: string; match?: RegExp }) {
- const $match = React.useMemo(
+ const $match = useMemo(
() =>
match instanceof RegExp
? match.flags.includes('g')
@@ -12,7 +12,7 @@ export const Highlight = function Highlight({ text, match }: { text: string; mat
[match],
)
- const chunks = React.useMemo(() => getChunks(text, $match), [text, $match])
+ const chunks = useMemo(() => getChunks(text, $match), [text, $match])
return <>{chunks.map(([type, text], key) => React.createElement(type, { key }, text))}>
}
diff --git a/src/components/HighlightOnIndexes.tsx b/src/components/HighlightOnIndexes.tsx
index f9748c5..2b62aa2 100644
--- a/src/components/HighlightOnIndexes.tsx
+++ b/src/components/HighlightOnIndexes.tsx
@@ -1,4 +1,4 @@
-import * as React from 'react'
+import React from 'react'
export function HighlightOnIndexes({ text, indexes = [] }: { text: string; indexes?: number[] }) {
return (
diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx
index 111651f..08c4a07 100644
--- a/src/components/Icon.tsx
+++ b/src/components/Icon.tsx
@@ -3,16 +3,15 @@ import {
ChevronRightIcon as ChevronRight,
ClockIcon as Clock,
CommentIcon as Comment,
- DiffAddedIcon as DiffAdded,
DiffIcon as Diff,
+ DiffAddedIcon as DiffAdded,
DiffIgnoredIcon as DiffIgnored,
DiffModifiedIcon as DiffModified,
DiffRemovedIcon as DiffRemoved,
DiffRenamedIcon as DiffRenamed,
- FileCodeIcon as FileCode,
FileIcon as File,
+ FileCodeIcon as FileCode,
FileMediaIcon as FileMedia,
- FileSubmoduleIcon as Submodule,
FileZipIcon as FileZip,
GearIcon as Gear,
GrabberIcon as Grabber,
@@ -22,10 +21,11 @@ import {
PinIcon as Pin,
ReplyIcon as Reply,
SearchIcon as Search,
+ FileSubmoduleIcon as Submodule,
TabIcon as Tab,
XIcon as X,
} from '@primer/octicons-react'
-import * as React from 'react'
+import React from 'react'
import { cx } from 'utils/cx'
const iconToComponentMap = {
diff --git a/src/components/Inputs/Checkbox.tsx b/src/components/Inputs/Checkbox.tsx
index 8e327d7..39777e2 100644
--- a/src/components/Inputs/Checkbox.tsx
+++ b/src/components/Inputs/Checkbox.tsx
@@ -1,5 +1,5 @@
-import { Checkbox as PrimerCheckbox, CheckboxProps, FormControl } from '@primer/react'
-import * as React from 'react'
+import { CheckboxProps, FormControl, Checkbox as PrimerCheckbox } from '@primer/react'
+import React from 'react'
export function Checkbox({
label,
diff --git a/src/components/Inputs/SelectInput.tsx b/src/components/Inputs/SelectInput.tsx
index e3dbe01..d177c75 100644
--- a/src/components/Inputs/SelectInput.tsx
+++ b/src/components/Inputs/SelectInput.tsx
@@ -1,5 +1,5 @@
import { FormControl, Select, SelectProps } from '@primer/react'
-import * as React from 'react'
+import React from 'react'
export type Option = {
key: string
diff --git a/src/components/LoadingIndicator.tsx b/src/components/LoadingIndicator.tsx
index 4295a83..8ceed5f 100644
--- a/src/components/LoadingIndicator.tsx
+++ b/src/components/LoadingIndicator.tsx
@@ -1,5 +1,5 @@
import { HourglassIcon } from '@primer/octicons-react'
-import * as React from 'react'
+import React from 'react'
type Props = {
text: React.ReactNode
diff --git a/src/components/MetaBar.tsx b/src/components/MetaBar.tsx
index 51f33a7..9cdcdca 100644
--- a/src/components/MetaBar.tsx
+++ b/src/components/MetaBar.tsx
@@ -2,11 +2,11 @@ import { GitBranchIcon } from '@primer/octicons-react'
import { Box, BranchName, Breadcrumbs, Text } from '@primer/react'
import { RepoContext } from 'containers/RepoContext'
import { platform } from 'platforms'
-import * as React from 'react'
+import React, { useContext } from 'react'
import { createAnchorClickHandler } from 'utils/createAnchorClickHandler'
export function MetaBar() {
- const metaData = React.useContext(RepoContext)
+ const metaData = useContext(RepoContext)
if (!metaData) return null
const { userName, repoName, branchName } = metaData
diff --git a/src/components/Portal.tsx b/src/components/Portal.tsx
index 2497954..99e968d 100644
--- a/src/components/Portal.tsx
+++ b/src/components/Portal.tsx
@@ -1,4 +1,4 @@
-import * as React from 'react'
+import React from 'react'
import * as ReactDOM from 'react-dom'
type Props = {
diff --git a/src/components/ResizeHandler.tsx b/src/components/ResizeHandler.tsx
index 521338f..727dc74 100644
--- a/src/components/ResizeHandler.tsx
+++ b/src/components/ResizeHandler.tsx
@@ -1,6 +1,6 @@
import { GrabberIcon } from '@primer/octicons-react'
import { Icon } from 'components/Icon'
-import * as React from 'react'
+import React from 'react'
import { ResizeHandlerOptions, useResizeHandler } from '../utils/hooks/useResizeHandler'
import { Size2D } from './Size'
diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx
index 0ca6202..3dea432 100644
--- a/src/components/SearchBar.tsx
+++ b/src/components/SearchBar.tsx
@@ -1,7 +1,7 @@
import { AlertIcon, SearchIcon, XIcon } from '@primer/octicons-react'
import { Popover, Text, TextInput, TextInputProps } from '@primer/react'
import { useConfigs } from 'containers/ConfigsContext'
-import * as React from 'react'
+import React, { useCallback, useMemo, useRef } from 'react'
import { formatWithShortcut, isValidRegexpSource } from 'utils/general'
import { useFocusOnPendingTarget } from './FocusTarget'
import { SearchMode } from './searchModes'
@@ -13,10 +13,10 @@ type Props = {
} & Required>
export function SearchBar({ onSearch, onFocus, value }: Props) {
- const ref = React.useRef(null)
+ const ref = useRef(null)
useFocusOnPendingTarget(
'search',
- React.useCallback(() => ref.current?.focus(), []),
+ useCallback(() => ref.current?.focus(), []),
)
const configs = useConfigs()
@@ -27,7 +27,7 @@ export function SearchBar({ onSearch, onFocus, value }: Props) {
? 'Match file name with regular expression.'
: `Match file path sequence with plain input.`
- const isInputValid = React.useMemo(
+ const isInputValid = useMemo(
() =>
({
regex: isValidRegexpSource(value),
@@ -35,7 +35,7 @@ export function SearchBar({ onSearch, onFocus, value }: Props) {
}[searchMode]),
[value, searchMode],
)
- const isSupportedRegex = React.useMemo(
+ const isSupportedRegex = useMemo(
() => !(searchMode === 'regex' && !getIsSupportedRegex(value)),
[value, searchMode],
)
diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx
index fa59de9..f711c00 100644
--- a/src/components/SideBar.tsx
+++ b/src/components/SideBar.tsx
@@ -7,7 +7,7 @@ import { Portal } from 'components/Portal'
import { ToggleShowButton } from 'components/ToggleShowButton'
import { useConfigs } from 'containers/ConfigsContext'
import { platform, platformName } from 'platforms'
-import * as React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { IIFC } from 'react-iifc'
import { useWindowSize } from 'react-use'
import { Config } from 'utils/config/helper'
@@ -50,9 +50,9 @@ export function SideBar() {
const configContext = useConfigs()
- const blockLeaveRef = React.useRef(false)
+ const blockLeaveRef = useRef(false)
const { sidebarToggleMode, shortcut, focusSearchInputShortcut } = configContext.value
- const onResizeStateChange = React.useCallback((state: ResizeState) => {
+ const onResizeStateChange = useCallback((state: ResizeState) => {
blockLeaveRef.current = state === 'resizing'
}, [])
@@ -61,7 +61,7 @@ export function SideBar() {
() => useWindowSize().height, // eslint-disable-line react-hooks/rules-of-hooks
)
- const sidebarContextValue = React.useMemo(() => ({ pendingFocusTarget }), [pendingFocusTarget])
+ const sidebarContextValue = useMemo(() => ({ pendingFocusTarget }), [pendingFocusTarget])
const placement = configContext.value.sidebarPlacement
@@ -146,15 +146,12 @@ export function SideBar() {