-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement custom
createContext
util function (#1442)
* refactor(utils): create createContext util function * refactor(tooltip): apply createContext util * refactor(segmented-control): apply create context util * feat(utils): change the createContext function to distinguish between null and undefined * refactor(form-control): apply createContext util * refactor(modal): apply createContext util fix ModalContentContextValue type declaration * style: remove unnecessary empty line * refactor(outline-item): apply createContext util * refactor(tab-list): apply createContext util * refactor(toast): apply createContext util * feat(feature-provider): apply createContext util * refactor(outline-item-context): fix type error (dead-code)
- Loading branch information
1 parent
80c5b5a
commit ded3f4e
Showing
30 changed files
with
128 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
packages/bezier-react/src/components/Forms/FormControl/FormControlContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { createContext } from 'react' | ||
import { createContext } from '~/src/utils/reactUtils' | ||
|
||
import { type FormControlContextValue } from '~/src/components/Forms/FormControl' | ||
|
||
export const FormControlContext = createContext<FormControlContextValue | undefined>(undefined) | ||
export const [ | ||
FormControlContextProvider, | ||
useFormControlContext, | ||
] = createContext<FormControlContextValue | undefined>(undefined) |
2 changes: 1 addition & 1 deletion
2
packages/bezier-react/src/components/Forms/FormControl/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import type { FormComponentProps } from './Form.types' | ||
import FormFieldSize from './FormFieldSize' | ||
import useFormControlContext from './useFormControlContext' | ||
import useFormFieldProps from './useFormFieldProps' | ||
import useKeyboardActionLockerWhileComposing from './useKeyboardActionLockerWhileComposing' | ||
|
||
export type { FormComponentProps } | ||
export * from './Inputs/constants/CommonImeControlKeys' | ||
export { | ||
FormFieldSize, | ||
useFormControlContext, | ||
useFormFieldProps, | ||
useKeyboardActionLockerWhileComposing, | ||
} |
9 changes: 0 additions & 9 deletions
9
packages/bezier-react/src/components/Forms/useFormControlContext.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,3 @@ export function Modal({ | |
</DialogPrimitive.Root> | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
packages/bezier-react/src/components/Modals/Modal/ModalContentContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import React from 'react' | ||
import { createContext } from '~/src/utils/reactUtils' | ||
|
||
import { type ModalContentContextValue } from './Modal.types' | ||
|
||
const ModalContentContext = React.createContext<ModalContentContextValue>({ | ||
export const [ | ||
ModalContentContextProvider, | ||
useModalContentContext, | ||
] = createContext<ModalContentContextValue>({ | ||
showCloseIcon: false, | ||
}) | ||
|
||
export default ModalContentContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
packages/bezier-react/src/components/OutlineItem/useOutlineItemContext.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.