-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): move ZIndexContext to singletons
- Loading branch information
Showing
6 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
packages/sanity/src/_singletons/components/zOffsets/ZIndexContext.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {createContext} from 'react' | ||
import type {ZIndexContextValue} from 'sanity' | ||
|
||
import {zIndexContextDefaults} from './zIndexContextDefaults' | ||
|
||
/** | ||
* TODO: Rename to `ZOffsetsContext` | ||
* | ||
* @internal | ||
*/ | ||
export const ZIndexContext = createContext<ZIndexContextValue>(zIndexContextDefaults) |
4 changes: 2 additions & 2 deletions
4
.../src/core/components/zOffsets/defaults.ts → ...ponents/zOffsets/zIndexContextDefaults.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './changeIndicators/ConnectorContext' | ||
export * from './components/previewCard/PreviewCardContext' | ||
export * from './components/scroll/scrollContext' | ||
export * from './components/zOffsets/ZIndexContext' | ||
export * from './components/zOffsets/zIndexContextDefaults' |
11 changes: 0 additions & 11 deletions
11
packages/sanity/src/core/components/zOffsets/ZIndexContext.ts
This file was deleted.
Oops, something went wrong.
6 changes: 2 additions & 4 deletions
6
packages/sanity/src/core/components/zOffsets/ZIndexProvider.tsx
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,13 +1,11 @@ | ||
import {type ReactElement, type ReactNode} from 'react' | ||
|
||
import {defaults} from './defaults' | ||
import {ZIndexContext} from './ZIndexContext' | ||
import {ZIndexContext, zIndexContextDefaults} from 'sanity/_singletons' | ||
|
||
/** | ||
* TODO: Rename to `ZOffsetsProvider` | ||
* | ||
* @internal | ||
*/ | ||
export function ZIndexProvider({children}: {children?: ReactNode}): ReactElement { | ||
return <ZIndexContext.Provider value={defaults}>{children}</ZIndexContext.Provider> | ||
return <ZIndexContext.Provider value={zIndexContextDefaults}>{children}</ZIndexContext.Provider> | ||
} |
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