chore: remove residual FC and FunctionComponent from components

This commit is contained in:
Bryan Lee
2022-08-12 10:56:22 +08:00
parent d3b4906da9
commit 495d9ccc0c
88 changed files with 99 additions and 123 deletions
@@ -5,7 +5,7 @@ import {
Protocol,
} from '@toeverything/datasource/db-service';
import { type CreateView } from '@toeverything/framework/virgo';
import { useEffect, useRef, useState, type FC } from 'react';
import { useEffect, useRef, useState } from 'react';
import {
TextManage,
@@ -1,4 +1,4 @@
import { FC, useState, useRef, useEffect } from 'react';
import { useState, useRef, useEffect } from 'react';
import { StyleWithAtRules } from 'style9';
import { CreateView } from '@toeverything/framework/virgo';
@@ -1,4 +1,4 @@
import { FC, useState } from 'react';
import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
import { styled } from '@toeverything/components/ui';
import { useOnSelect } from '@toeverything/components/editor-core';
@@ -1,4 +1,4 @@
import { FC, useState } from 'react';
import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
import {
BlockPendantProvider,
@@ -1,4 +1,4 @@
import { FC, useState } from 'react';
import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
import {
useOnSelect,
@@ -1,4 +1,4 @@
import { FC, useState, useEffect, useRef } from 'react';
import { useState, useEffect, useRef } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
import { Upload } from '../../components/upload/upload';
import { services, FileColumnValue } from '@toeverything/datasource/db-service';
@@ -1,4 +1,4 @@
import { FC, useEffect, useLayoutEffect, useRef } from 'react';
import { useEffect, useLayoutEffect, useRef } from 'react';
import { ChildrenView } from '@toeverything/framework/virgo';
import { styled } from '@toeverything/components/ui';
import { sleep } from '@toeverything/utils';
@@ -1,8 +1,9 @@
import { FC } from 'react';
import { RenderBlock } from '@toeverything/components/editor-core';
import { ChildrenView, CreateView } from '@toeverything/framework/virgo';
export const GridItemRender = function (creator: FC<ChildrenView>) {
export const GridItemRender = function (
creator: (prop: ChildrenView) => JSX.Element
) {
const GridItem = function (props: CreateView) {
const { block } = props;
const children = (
@@ -1,4 +1,3 @@
import type { FC } from 'react';
import { useState } from 'react';
import { styled } from '@toeverything/components/ui';
import { BlockEditor } from '@toeverything/framework/virgo';
@@ -1,6 +1,6 @@
import { RenderBlock } from '@toeverything/components/editor-core';
import { CreateView } from '@toeverything/framework/virgo';
import React, { FC, useEffect, useRef, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { GridHandle } from './GirdHandle';
import { styled } from '@toeverything/components/ui';
import ReactDOM from 'react-dom';
@@ -1,8 +1,7 @@
import { FC } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
import { BlockContainer } from '../../components/BlockContainer';
export function GridRender(creator: FC<CreateView>) {
export function GridRender(creator: (prop: CreateView) => JSX.Element) {
return function GridWithItem(props: CreateView) {
const { editor, block } = props;
return (
@@ -8,7 +8,7 @@ import {
} from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui';
import type { CreateView } from '@toeverything/framework/virgo';
import type { ComponentType, FC } from 'react';
import type { ComponentType } from 'react';
import { useState } from 'react';
import { GroupMenuWrapper } from './group-menu';
import { SceneKanban } from './scene-kanban';
@@ -1,6 +1,5 @@
import { RenderBlockChildren } from '@toeverything/components/editor-core';
import type { CreateView } from '@toeverything/framework/virgo';
import { FC } from 'react';
export const ScenePage = ({ block }: CreateView) => {
return <RenderBlockChildren block={block} />;
@@ -1,4 +1,3 @@
import type { FC } from 'react';
import { useState, useMemo, useEffect } from 'react';
import type { DefaultColumnsValue } from '@toeverything/datasource/db-service';
import type { CreateView } from '@toeverything/framework/virgo';
@@ -1,9 +1,9 @@
import { styled } from '@toeverything/components/ui';
import type { FC } from 'react';
import type { SvgIconProps } from '@toeverything/components/ui';
interface Props {
Icon: FC<SvgIconProps>;
Icon: (prop: SvgIconProps) => JSX.Element;
text?: string;
onClick: () => void;
}
@@ -1,4 +1,3 @@
import { FC } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
export const GroupDividerView = ({ block, editor }: CreateView) => {
@@ -6,7 +6,7 @@ import {
import { styled } from '@toeverything/components/ui';
import { services } from '@toeverything/datasource/db-service';
import { CreateView } from '@toeverything/framework/virgo';
import { FC, useEffect, useRef, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { Image as SourceView } from '../../components/ImageView';
import { Upload } from '../../components/upload/upload';
import { SCENE_CONFIG } from '../group/config';
@@ -5,7 +5,7 @@ import {
Protocol,
} from '@toeverything/datasource/db-service';
import { type CreateView } from '@toeverything/framework/virgo';
import { useEffect, useRef, useState, type FC } from 'react';
import { useEffect, useRef, useState } from 'react';
import {
TextManage,
type ExtendedTextUtils,
@@ -1,4 +1,4 @@
import { FC, useRef, useEffect, useMemo, useState } from 'react';
import { useRef, useEffect, useMemo, useState } from 'react';
import { useParams } from 'react-router';
import { BackLink, TextProps } from '@toeverything/components/common';
@@ -13,9 +13,9 @@ import {
} from '@toeverything/framework/virgo';
import { PageView } from './PageView';
import { ComponentType, FC } from 'react';
export const PageChildrenView: FC<ChildrenView> = props => props.children;
export const PageChildrenView: (prop: ChildrenView) => JSX.Element = props =>
props.children;
export class PageBlock extends BaseView {
type = Protocol.Block.Type.page;
@@ -1,4 +1,4 @@
import { FC, useEffect, useMemo, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { InlineRefLink } from '@toeverything/components/common';
import { CreateView } from '@toeverything/framework/virgo';
@@ -10,13 +10,13 @@ import {
getTextProperties,
SelectBlock,
} from '@toeverything/framework/virgo';
import { FC } from 'react';
import { TextView } from './TextView';
export class QuoteBlock extends BaseView {
type = Protocol.Block.Type.quote;
View: FC<CreateView> = TextView;
View: (prop: CreateView) => JSX.Element = TextView;
// override ChildrenView = IndentWrapper;
@@ -83,7 +83,7 @@ export class QuoteBlock extends BaseView {
export class CalloutBlock extends BaseView {
type = Protocol.Block.Type.callout;
View: FC<CreateView> = TextView;
View: (prop: CreateView) => JSX.Element = TextView;
// override ChildrenView = IndentWrapper;
@@ -11,13 +11,13 @@ import {
Protocol,
} from '@toeverything/datasource/db-service';
import { TextView } from './TextView';
import { FC } from 'react';
import { getRandomString } from '@toeverything/components/common';
export class TextBlock extends BaseView {
type = Protocol.Block.Type.text;
View: FC<CreateView> = TextView;
View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) {
@@ -134,7 +134,7 @@ export class TextBlock extends BaseView {
export class Heading1Block extends BaseView {
type = Protocol.Block.Type.heading1;
View: FC<CreateView> = TextView;
View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) {
@@ -199,7 +199,7 @@ export class Heading1Block extends BaseView {
export class Heading2Block extends BaseView {
type = Protocol.Block.Type.heading2;
View: FC<CreateView> = TextView;
View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) {
@@ -264,7 +264,7 @@ export class Heading2Block extends BaseView {
export class Heading3Block extends BaseView {
type = Protocol.Block.Type.heading3;
View: FC<CreateView> = TextView;
View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) {
@@ -1,4 +1,4 @@
import { FC, useState } from 'react';
import { useState } from 'react';
import { CustomText, TextProps } from '@toeverything/components/common';
import {
@@ -1,4 +1,4 @@
import { FC, useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
import {
is_heading_child_type,
@@ -1,5 +1,5 @@
import { styled } from '@toeverything/components/ui';
import { FC, useMemo } from 'react';
import { useMemo } from 'react';
interface CheckBoxProps {
size?: number;
@@ -5,7 +5,7 @@ import {
Protocol,
} from '@toeverything/datasource/db-service';
import { AsyncBlock, type CreateView } from '@toeverything/framework/virgo';
import { useRef, type FC } from 'react';
import { useRef } from 'react';
import {
TextManage,
type ExtendedTextUtils,
@@ -1,4 +1,4 @@
import { FC, useState } from 'react';
import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo';
import { Upload } from '../../components/upload/upload';
import { SourceView } from '../../components/source-view';
@@ -1,4 +1,3 @@
import type { FC } from 'react';
import { styled } from '@toeverything/components/ui';
import { AsyncBlock, BlockEditor } from '@toeverything/framework/virgo';
@@ -1,5 +1,5 @@
import { AsyncBlock } from '@toeverything/framework/virgo';
import { FC } from 'react';
import { ResizableBox } from 'react-resizable';
import { styled } from '@toeverything/components/ui';
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from 'react';
import { PropsWithChildren } from 'react';
import { ChildrenView } from '@toeverything/framework/virgo';
import { styled } from '@toeverything/components/ui';
@@ -1,4 +1,4 @@
import { FC, useMemo } from 'react';
import { useMemo } from 'react';
import { createEditor } from 'slate';
import { Slate, Editable as SlateEditable, withReact } from 'slate-react';
import { ErrorBoundary } from '@toeverything/utils';
@@ -4,14 +4,7 @@ import {
useLazyIframe,
} from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui';
import {
FC,
ReactElement,
ReactNode,
useEffect,
useRef,
useState,
} from 'react';
import { ReactElement, ReactNode, useEffect, useRef, useState } from 'react';
import { SCENE_CONFIG } from '../../blocks/group/config';
import { BlockPreview } from './BlockView';
import { formatUrl } from './format-url';
@@ -6,7 +6,7 @@ import {
useLayoutEffect,
useCallback,
} from 'react';
import type { FC } from 'react';
import { VariableSizeGrid, areEqual } from 'react-window';
import type {
GridChildComponentProps,
@@ -34,7 +34,7 @@ export interface CustomCellProps<T = unknown> {
value: T;
valueKey: string;
}
export type CustomCell<T = unknown> = FC<CustomCellProps<T>>;
export type CustomCell<T = unknown> = (prop: CustomCellProps<T>) => JSX.Element;
interface TableData {
columns: readonly TableColumn[];
@@ -1,4 +1,3 @@
import type { FC } from 'react';
import { Checkbox } from '@toeverything/components/ui';
import type { BooleanColumnValue } from '@toeverything/datasource/db-service';
import type { CellProps } from '../types';
@@ -1,4 +1,3 @@
import type { FC } from 'react';
import { ColumnType } from '@toeverything/datasource/db-service';
import type { CustomCellProps as TableCustomCellProps } from '../basic-table';
import { DEFAULT_RENDER_CELL } from '../basic-table';
@@ -16,7 +15,7 @@ const DefaultCell = ({ onChange, ...props }: CellProps) => {
/**
* @deprecated
*/
const cellMap: Record<ColumnType, FC<CellProps<any>>> = {
const cellMap: Record<ColumnType, (prop: CellProps<any>) => JSX.Element> = {
[ColumnType.content]: DefaultCell,
[ColumnType.number]: DefaultCell,
[ColumnType.enum]: SelectCell,
@@ -1,4 +1,3 @@
import type { FC } from 'react';
import { useMemo } from 'react';
import { OldSelect } from '@toeverything/components/ui';
import type { EnumColumnValue } from '@toeverything/datasource/db-service';
@@ -1,4 +1,4 @@
import type { FC, ReactNode } from 'react';
import type { ReactNode } from 'react';
import { BasicTable } from './basic-table';
import type { BasicTableProps } from './basic-table';
@@ -1,5 +1,4 @@
import {
FC,
useRef,
ChangeEvent,
ReactElement,