-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(portal-context): 改写名字代码 (#3060)
- Loading branch information
wanjinping
committed
Dec 17, 2024
1 parent
b163677
commit 51cdccc
Showing
27 changed files
with
95 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
--- | ||
"@hi-ui/core": patch | ||
"@hi-ui/container-context": patch | ||
"@hi-ui/drawer": patch | ||
"@hi-ui/hiui": patch | ||
"@hi-ui/loading": patch | ||
"@hi-ui/modal": patch | ||
"@hi-ui/preview": patch | ||
"@hi-ui/provider": patch | ||
"@hi-ui/core": minor | ||
"@hi-ui/container-context": minor | ||
"@hi-ui/drawer": minor | ||
"@hi-ui/hiui": minor | ||
"@hi-ui/loading": minor | ||
"@hi-ui/modal": minor | ||
"@hi-ui/preview": minor | ||
"@hi-ui/provider": minor | ||
--- | ||
|
||
feat(container-context): add container package (#3060) |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/ui/container-context/__tests__/locale-context.test.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `@hi-ui/portal-context` | ||
|
||
> TODO: description | ||
## Usage | ||
|
||
``` | ||
const PortalContext = require('@hi-ui/portal-context'); | ||
// TODO: DEMONSTRATE API | ||
``` |
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,5 @@ | ||
const PortalContext = require('../src') | ||
|
||
describe('@hi-ui/portal-context', () => { | ||
it('needs tests', () => {}) | ||
}) |
2 changes: 1 addition & 1 deletion
2
...s/ui/container-context/hi-docs.config.mdx → ...ages/ui/portal-context/hi-docs.config.mdx
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,4 +1,4 @@ | ||
# ContainerContext 语言上下文 | ||
# PortalContext 上下文 | ||
|
||
容器设置上下文。 | ||
|
||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/ui/container-context/package.json → packages/ui/portal-context/package.json
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { createContext, useContext } from 'react' | ||
|
||
export const PortalContext = createContext<UsePortalContext>(null) | ||
|
||
export const usePortalContext = () => { | ||
const context = useContext(PortalContext) | ||
|
||
return context | ||
} | ||
|
||
export type UsePortalContext = { container?: HTMLElement | null | undefined } | null | undefined |
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,18 @@ | ||
import React from 'react' | ||
import { PortalContext, UsePortalContext } from './PortalContext' | ||
import { __DEV__ } from '@hi-ui/env' | ||
|
||
export const PortalProvider: React.FC<PortalProviderProps> = ({ children, portal }) => { | ||
return <PortalContext.Provider value={portal}>{children}</PortalContext.Provider> | ||
} | ||
|
||
export interface PortalProviderProps { | ||
/** | ||
* 指定 portal 的容器 | ||
*/ | ||
portal?: UsePortalContext | ||
} | ||
|
||
if (__DEV__) { | ||
PortalProvider.displayName = 'PortalProvider' | ||
} |
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,4 @@ | ||
export * from './PortalContext' | ||
export * from './PortalProvider' | ||
|
||
export { PortalProvider as default } from './PortalProvider' |
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,16 @@ | ||
import React, { useContext } from 'react' | ||
import { PortalContext } from '../src' | ||
|
||
/** | ||
* @title 基础用法 | ||
*/ | ||
export const Basic = () => { | ||
useContext(PortalContext) | ||
|
||
return ( | ||
<> | ||
<h1>Basic</h1> | ||
<div className="portal-context-basic__wrap"></div> | ||
</> | ||
) | ||
} |
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
File renamed without changes.
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