Skip to content

Commit

Permalink
fix: refactor readme
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG committed Oct 4, 2023
1 parent 9b8c861 commit 8efe691
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import {CSSTransition} from 'react-transition-group';

import {useBodyScrollLock} from '../../hooks/useBodyScrollLock';
import {useBodyScrollLock} from '../../hooks';
import {Portal} from '../Portal';
import type {DOMProps, QAProps} from '../types';
import {FocusTrap} from '../utils/FocusTrap';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popup/__stories__/Popup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import type {Meta, StoryFn} from '@storybook/react';

import {useVirtualElementRef} from '../../../hooks/useVirtualElementRef';
import {useVirtualElementRef} from '../../../hooks';
import {Button} from '../../Button';
import {TextInput} from '../../controls';
import {Popup} from '../Popup';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Portal/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import ReactDOM from 'react-dom';

import {usePortalContainer} from '../../hooks/usePortalContainer/usePortalContainer';
import {usePortalContainer} from '../../hooks';

export interface PortalProps {
container?: HTMLElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import {Text} from '../../../Text';
import {Flex} from '../../Flex/Flex';
import {LayoutProvider} from '../../LayoutProvider/LayoutProvider';
import {useLayoutContext} from '../../hooks/useLayoutContext';
import {useLayoutContext} from '../../hooks';
import {sp} from '../../spacing/spacing';

interface LayoutPresenterProps {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useBodyScrollLock/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {useBodyScrollLock} from './useBodyScrollLock';
export type {BodyScrollLockProps} from './useBodyScrollLock';
export type {BodyScrollLockProps, UseBodyScrollLockProps} from './useBodyScrollLock';
6 changes: 4 additions & 2 deletions src/hooks/useBodyScrollLock/useBodyScrollLock.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';

export interface BodyScrollLockProps {
export interface UseBodyScrollLockProps {
enabled: boolean;
}

export type BodyScrollLockProps = UseBodyScrollLockProps;

let locks = 0;
let storedBodyStyle: string | undefined;

export function useBodyScrollLock({enabled}: BodyScrollLockProps) {
export function useBodyScrollLock({enabled}: UseBodyScrollLockProps) {
React.useLayoutEffect(() => {
if (enabled) {
locks++;
Expand Down
4 changes: 1 addition & 3 deletions src/hooks/usePortalContainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ The `usePortalContainer` hook returns portal container element in the current sc

## Result

| Name | Description | Type |
| :-------- | :--------------------------- | :------------------: |
| container | Container element for portal | `HTMLElement - null` |
Container element for portal. `HTMLElement | null`
6 changes: 2 additions & 4 deletions src/hooks/useVirtualElementRef/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ The `useVirtualElementRef` hook helps to create virtual element for popup
| rect | Position of virtual element relative to viewport | `{top, bottom, left, right}: {[x]:number}` | |
| contextElement | DOM-context of virtual element | `Element` | |

## Return
## Result

| Name | Description | Type |
| :--- | :----------------------- | :---------------: |
| ref | Virtual element ref link | `React.RefObject` |
Virtual element ref link. `React.RefObject`

0 comments on commit 8efe691

Please sign in to comment.