Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: private hooks directory #1091

Merged
merged 5 commits into from
Nov 9, 2023
Merged

refactor: private hooks directory #1091

merged 5 commits into from
Nov 9, 2023

Conversation

NikitaCG
Copy link
Contributor

@NikitaCG NikitaCG commented Nov 3, 2023

No description provided.

@NikitaCG NikitaCG linked an issue Nov 3, 2023 that may be closed by this pull request
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@NikitaCG NikitaCG force-pushed the refactor/private-hooks branch from 152d969 to 10b8975 Compare November 3, 2023 15:18
@NikitaCG NikitaCG changed the title WIP: refactor: private hooks directory refactor: private hooks directory Nov 7, 2023
@@ -0,0 +1,26 @@
# useCheckbox

The `useCheckbox` hook need to generate props for radio group element
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

radio group element -> checkbox control


## Result

- checked, radio-input status `boolean`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use md table here, checked - Checked state, inputProps - Props to pass to the input element

## Result

- onMouseOver, `React.MouseEventHandler`
- onMouseLeave, `React.MouseEventHandler`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

md table

@@ -0,0 +1,25 @@
# useRadio

The `useRadio` hook need to generate props for radio group element
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

element -> control

## Result

- checked, radio-input status `boolean`
- inputProps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for useCheckbox

@@ -0,0 +1,22 @@
# useRadioGroup

The `useRadioGroup` hook need to generate props for radio group element
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

element -> control

## Result

- containerProps
- optionsProps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for useCheckbox


## Result

- onFocus, `(event: React.FocusEvent) => void`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

md table

## Result

- state, `any`
- setWithCallback, `(nextValue: T | ((value: T) => T)) => void`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

md table

@NikitaCG NikitaCG force-pushed the refactor/private-hooks branch from 10b8975 to 82f6ddc Compare November 8, 2023 15:08
export * from './useBoolean';
export * from './useCheckbox';
export * from './useCloseOnTimeout';
export * from './useConditionallyControlledState';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this private hook? It's general, it can be used by any app.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was not exported outside

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok ✅
Seems like it will be good to make it public.

@NikitaCG NikitaCG force-pushed the refactor/private-hooks branch from 82f6ddc to 25d4164 Compare November 9, 2023 11:31
@amje amje merged commit 6af17ea into main Nov 9, 2023
3 checks passed
@amje amje deleted the refactor/private-hooks branch November 9, 2023 15:14
IsaevAlexandr pushed a commit to IsaevAlexandr/uikit that referenced this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hooks docs and typings
5 participants