chore: rename to ref page

This commit is contained in:
lawvs 2022-08-03 15:23:01 +08:00
parent c609d40f5a
commit 974239bf9d
6 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@ import type { KanbanCard } from '@toeverything/components/editor-core';
import {
RenderBlock,
useKanban,
useSubPage,
useRefPage,
} from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui';
@ -62,7 +62,7 @@ export const CardItem = ({
block: KanbanCard['block'];
}) => {
const { addSubItem } = useKanban();
const { openSubPage } = useSubPage();
const { openSubPage } = useRefPage();
const onAddItem = async () => {
await addSubItem(block);
};

View File

@ -17,4 +17,4 @@ export * from './utils';
export * from './editor';
export { SubPageProvider, useSubPage } from './sub-page';
export { RefPageProvider, useRefPage } from './ref-page';

View File

@ -2,7 +2,7 @@ import { Protocol } from '@toeverything/datasource/db-service';
import { AsyncBlock } from '../editor';
import { ComponentType, createContext, ReactNode, useContext } from 'react';
import { RecastBlock } from './types';
import { SubPageProvider } from '../sub-page';
import { RefPageProvider } from '../ref-page';
/**
* Determine whether the block supports RecastBlock
@ -48,7 +48,7 @@ export const RecastBlockProvider = ({
return (
<RecastBlockContext.Provider value={block}>
<SubPageProvider>{children}</SubPageProvider>
<RefPageProvider>{children}</RefPageProvider>
</RecastBlockContext.Provider>
);
};

View File

@ -15,7 +15,7 @@ const Dialog = styled('div')({
const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => {
const theme = useTheme();
const { closeSubPage } = useSubPage();
const { closeSubPage } = useRefPage();
return createPortal(
<MuiBackdrop
@ -55,7 +55,7 @@ const SubPageContext = createContext<
ReturnType<typeof useState<string | null>> | undefined
>(undefined);
export const SubPageProvider = ({ children }: { children: ReactNode }) => {
export const RefPageProvider = ({ children }: { children: ReactNode }) => {
const state = useState<string | null>();
const [blockId, setBlockId] = state;
@ -67,7 +67,7 @@ export const SubPageProvider = ({ children }: { children: ReactNode }) => {
);
};
export const useSubPage = () => {
export const useRefPage = () => {
const context = useContext(SubPageContext);
if (!context) {
throw new Error(

View File

@ -0,0 +1 @@
export { useRefPage, RefPageProvider } from './ModalPage';

View File

@ -1 +0,0 @@
export { useSubPage, SubPageProvider } from './ModalPage';