refactor: remove React.FC for component package (#3575)

This commit is contained in:
Garfield Lee
2023-08-04 23:00:28 +08:00
committed by GitHub
parent 7ec4b8fb8c
commit 65fc0ed59c
21 changed files with 165 additions and 149 deletions
@@ -28,6 +28,17 @@ import type { ListData, PageListProps, TrashListData } from './type';
import { useSorter } from './use-sorter';
import { formatDate, useIsSmallDevices } from './utils';
interface AllPagesHeadProps {
isPublicWorkspace: boolean;
sorter: ReturnType<typeof useSorter<ListData>>;
createNewPage: () => void;
createNewEdgeless: () => void;
importFile: () => void;
getPageInfo: GetPageInfoById;
propertiesMeta: PropertiesMeta;
workspaceId: string;
}
const AllPagesHead = ({
isPublicWorkspace,
sorter,
@@ -37,16 +48,7 @@ const AllPagesHead = ({
getPageInfo,
propertiesMeta,
workspaceId,
}: {
isPublicWorkspace: boolean;
sorter: ReturnType<typeof useSorter<ListData>>;
createNewPage: () => void;
createNewEdgeless: () => void;
importFile: () => void;
getPageInfo: GetPageInfoById;
propertiesMeta: PropertiesMeta;
workspaceId: string;
}) => {
}: AllPagesHeadProps) => {
const t = useAFFiNEI18N();
const titleList = useMemo(
() => [
@@ -235,10 +237,15 @@ const TrashListHead = () => {
);
};
export const PageListTrashView: React.FC<{
interface PageListTrashViewProps {
list: TrashListData[];
fallback?: React.ReactNode;
}> = ({ list, fallback }) => {
}
export const PageListTrashView = ({
list,
fallback,
}: PageListTrashViewProps) => {
const t = useAFFiNEI18N();
const theme = useTheme();
@@ -8,7 +8,6 @@ import {
OpenInNewIcon,
ResetIcon,
} from '@blocksuite/icons';
import type React from 'react';
import { useState } from 'react';
import {
@@ -21,7 +20,7 @@ import {
} from '../../..';
import { DisablePublicSharing, MoveToTrash } from './operation-menu-items';
export type OperationCellProps = {
export interface OperationCellProps {
title: string;
favorite: boolean;
isPublic: boolean;
@@ -29,9 +28,9 @@ export type OperationCellProps = {
onToggleFavoritePage: () => void;
onRemoveToTrash: () => void;
onDisablePublicSharing: () => void;
};
}
export const OperationCell: React.FC<OperationCellProps> = ({
export const OperationCell = ({
title,
favorite,
isPublic,
@@ -39,7 +38,7 @@ export const OperationCell: React.FC<OperationCellProps> = ({
onToggleFavoritePage,
onRemoveToTrash,
onDisablePublicSharing,
}) => {
}: OperationCellProps) => {
const t = useAFFiNEI18N();
const [open, setOpen] = useState(false);
const [openDisableShared, setOpenDisableShared] = useState(false);
@@ -118,16 +117,16 @@ export const OperationCell: React.FC<OperationCellProps> = ({
);
};
export type TrashOperationCellProps = {
export interface TrashOperationCellProps {
onPermanentlyDeletePage: () => void;
onRestorePage: () => void;
onOpenPage: () => void;
};
}
export const TrashOperationCell: React.FC<TrashOperationCellProps> = ({
export const TrashOperationCell = ({
onPermanentlyDeletePage,
onRestorePage,
}) => {
}: TrashOperationCellProps) => {
const t = useAFFiNEI18N();
const [open, setOpen] = useState(false);
return (