refactor: remove React.FC (#3694)

This commit is contained in:
Garfield Lee 2023-08-11 22:58:44 +08:00 committed by GitHub
parent ce21ea78eb
commit e9f4912665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -6,7 +6,7 @@ import type {
PassiveDocProvider, PassiveDocProvider,
Workspace as BlockSuiteWorkspace, Workspace as BlockSuiteWorkspace,
} from '@blocksuite/store'; } from '@blocksuite/store';
import type { FC, PropsWithChildren } from 'react'; import type { PropsWithChildren, ReactNode } from 'react';
import type { Collection } from './filter.js'; import type { Collection } from './filter.js';
@ -27,14 +27,14 @@ export interface AffineDownloadProvider extends PassiveDocProvider {
} }
/** /**
* Download the first binary from local indexeddb * Download the first binary from local IndexedDB
*/ */
export interface BroadCastChannelProvider extends PassiveDocProvider { export interface BroadCastChannelProvider extends PassiveDocProvider {
flavour: 'broadcast-channel'; flavour: 'broadcast-channel';
} }
/** /**
* Long polling provider with local indexeddb * Long polling provider with local IndexedDB
*/ */
export interface LocalIndexedDBBackgroundProvider export interface LocalIndexedDBBackgroundProvider
extends StatusAdapter, extends StatusAdapter,
@ -165,6 +165,10 @@ type PageListProps<_Flavour extends keyof WorkspaceRegistry> = {
collection: Collection; collection: Collection;
}; };
interface FC<P> {
(props: P): ReactNode;
}
export interface WorkspaceUISchema<Flavour extends keyof WorkspaceRegistry> { export interface WorkspaceUISchema<Flavour extends keyof WorkspaceRegistry> {
Header: FC<WorkspaceHeaderProps<Flavour>>; Header: FC<WorkspaceHeaderProps<Flavour>>;
PageDetail: FC<PageDetailProps<Flavour>>; PageDetail: FC<PageDetailProps<Flavour>>;

View File

@ -4,7 +4,7 @@ import type { Page } from '@blocksuite/store';
import type { Workspace } from '@blocksuite/store'; import type { Workspace } from '@blocksuite/store';
import type { Atom, getDefaultStore } from 'jotai/vanilla'; import type { Atom, getDefaultStore } from 'jotai/vanilla';
import type { WritableAtom } from 'jotai/vanilla/atom'; import type { WritableAtom } from 'jotai/vanilla/atom';
import type { FC } from 'react'; import type { FunctionComponent } from 'react';
export type Part = 'headerItem' | 'editor' | 'setting' | 'formatBar'; export type Part = 'headerItem' | 'editor' | 'setting' | 'formatBar';
@ -22,7 +22,7 @@ export type CallbackMap = {
export interface PluginContext { export interface PluginContext {
register: <T extends Part>(part: T, callback: CallbackMap[T]) => void; register: <T extends Part>(part: T, callback: CallbackMap[T]) => void;
utils: { utils: {
PluginProvider: FC; PluginProvider: FunctionComponent; // make more clear
}; };
} }

View File

@ -4,7 +4,7 @@ import type { SerializedBlock } from '@blocksuite/blocks';
import type { BaseBlockModel } from '@blocksuite/store'; import type { BaseBlockModel } from '@blocksuite/store';
import type { Page } from '@blocksuite/store'; import type { Page } from '@blocksuite/store';
import type { VEditor } from '@blocksuite/virgo'; import type { VEditor } from '@blocksuite/virgo';
import type { FC, ReactElement } from 'react'; import type { ReactElement } from 'react';
import { StrictMode } from 'react'; import { StrictMode } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react';
@ -121,7 +121,7 @@ const shouldShowBookmarkMenu = (pastedBlocks: SerializedBlock[]) => {
return !!firstBlock.text[0].attributes?.link; return !!firstBlock.text[0].attributes?.link;
}; };
const BookMarkUI: FC<BookMarkProps> = ({ page }) => { const BookMarkUI = ({ page }: BookMarkProps) => {
const [anchor, setAnchor] = useState<Range | null>(null); const [anchor, setAnchor] = useState<Range | null>(null);
const [selectedOption, setSelectedOption] = useState<string>( const [selectedOption, setSelectedOption] = useState<string>(
menuOptions[0].id menuOptions[0].id