Skip to content

Commit

Permalink
refactor: use hooks from react-use
Browse files Browse the repository at this point in the history
  • Loading branch information
shervinchen committed May 5, 2024
1 parent 41202da commit e04e518
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 44 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"classnames": "^2.3.2",
"react-feather": "^2.0.10",
"react-remove-scroll": "^2.5.7",
"react-use": "^17.5.0",
"styled-jsx": "^5.1.2"
}
}
3 changes: 2 additions & 1 deletion packages/Popover/Popover.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { FC, PropsWithChildren, useRef } from 'react';
import classNames from 'classnames';
import { useClickAway } from 'react-use';
import { PopoverProps } from './Popover.types';
import { useClickAway, useControlled, useTransition } from '../utils/hooks';
import { useControlled, useTransition } from '../utils/hooks';
import Popup from '../Popup';
import { computePopupPosition } from '../Popup/computePopup';
import { useTheme } from '../Theme';
Expand Down
3 changes: 2 additions & 1 deletion packages/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import React, {
} from 'react';
import { ChevronDown } from 'react-feather';
import classNames from 'classnames';
import { useClickAway } from 'react-use';
import {
SelectConfig,
SelectOptionValue,
SelectProps,
SelectRef,
SelectValue,
} from './Select.types';
import { useClickAway, useControlled } from '../utils/hooks';
import { useControlled } from '../utils/hooks';
import { RawUITheme } from '../Theme/preset/preset.type';
import { useTheme } from '../Theme/theme-context';
import { getValidChildren } from '../utils/common';
Expand Down
2 changes: 0 additions & 2 deletions packages/utils/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { usePortal } from './usePortal';
import { useResize } from './useResize';
import { useClickAnyWhere } from './useClickAnyWhere';
import { useMutationObserver } from './useMutationObserver';
import { useClickAway } from './useClickAway';

export {
useControlled,
Expand All @@ -15,5 +14,4 @@ export {
useResize,
useClickAnyWhere,
useMutationObserver,
useClickAway,
};
32 changes: 0 additions & 32 deletions packages/utils/hooks/useClickAway.ts

This file was deleted.

Loading

0 comments on commit e04e518

Please sign in to comment.