Skip to content

Commit

Permalink
fix: comment review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG committed Oct 4, 2023
1 parent bab6c24 commit 44bf542
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './useOutsideClick';
export * from './useBodyScrollLock';
export * from './useVirtualElementRef';
export * from './useOutsideClick';
export * from './usePortalContainer';
export * from './useVirtualElementRef';
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 {UseBodyScrollLockProps} from './useBodyScrollLock';
export type {BodyScrollLockProps} from './useBodyScrollLock';
4 changes: 2 additions & 2 deletions src/hooks/useBodyScrollLock/useBodyScrollLock.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';

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

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

export function useBodyScrollLock({enabled}: UseBodyScrollLockProps) {
export function useBodyScrollLock({enabled}: BodyScrollLockProps) {
React.useLayoutEffect(() => {
if (enabled) {
locks++;
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/usePortalContainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import {usePortalContainer} from '@gravity-ui/uikit';
```

The `usePortalContainer` hook helps to create portal container
The `usePortalContainer` hook returns portal container element in the current scope

## Return
## Result

| Name | Description | Type |
| :-------- | :--------------------------- | :------------------: |
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePortalContainer/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export {usePortalContainer} from './usePortalContainer';
export {PortalProvider} from './PortalProvider';
export type {UsePortalContainerReturnType} from './usePortalContainer';
export type {UsePortalContainerResult} from './usePortalContainer';
4 changes: 2 additions & 2 deletions src/hooks/usePortalContainer/usePortalContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from 'react';

import {PortalContext} from './PortalProvider';

export type UsePortalContainerReturnType = HTMLElement | null;
export type UsePortalContainerResult = HTMLElement | null;

export function usePortalContainer(): UsePortalContainerReturnType {
export function usePortalContainer(): UsePortalContainerResult {
const context = React.useContext(PortalContext);

let defaultContainer = null;
Expand Down
14 changes: 7 additions & 7 deletions src/hooks/useVirtualElementRef/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ The `useVirtualElementRef` hook helps to create virtual element for popup

## Properties

| Name | Description | Type | Default |
| :------------- | :-------------------------------------------------- | :----------------------------------------: | :-----: |
| rect | Position of virtual element in relation to viewport | `{top, bottom, left, right}: {[x]:number}` | |
| contextElement | DOM-context of virtual element | `Element` | |
| Name | Description | Type | Default |
| :------------- | :----------------------------------------------- | :----------------------------------------: | :-----: |
| rect | Position of virtual element relative to viewport | `{top, bottom, left, right}: {[x]:number}` | |
| contextElement | DOM-context of virtual element | `Element` | |

## Return

| Name | Description | Type |
| :--- | :----------------------- | :----------------------: |
| ref | Virtual element ref link | `React.MutableRefObject` |
| Name | Description | Type |
| :--- | :----------------------- | :---------------: |
| ref | Virtual element ref link | `React.RefObject` |
2 changes: 1 addition & 1 deletion src/hooks/useVirtualElementRef/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export {useVirtualElementRef} from './useVirtualElementRef';
export type {
VirtualElementRect,
UseVirtualElementRefProps,
UseVirtualElementRefReturnType,
UseVirtualElementRefResult,
} from './useVirtualElementRef';
6 changes: 3 additions & 3 deletions src/hooks/useVirtualElementRef/useVirtualElementRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type VirtualElementRect = {

export interface UseVirtualElementRefProps {
/**
* Position of virtual element in relation to viewport
* Position of virtual element relative to viewport
*/
rect?: VirtualElementRect | null;

Expand All @@ -21,14 +21,14 @@ export interface UseVirtualElementRefProps {
contextElement?: Element;
}

export type UseVirtualElementRefReturnType = React.MutableRefObject<VirtualElement>;
export type UseVirtualElementRefResult = React.MutableRefObject<VirtualElement>;

const initialPosition = {top: 0, right: 0, bottom: 0, left: 0};

// React hook for creating virtual element for popup
export function useVirtualElementRef(
props: UseVirtualElementRefProps = {},
): UseVirtualElementRefReturnType {
): UseVirtualElementRefResult {
const {rect, contextElement} = props;
const rectRef = React.useRef(initialPosition);

Expand Down

0 comments on commit 44bf542

Please sign in to comment.