type: remove type FC in site (#38959)

This commit is contained in:
lijianan 2022-11-24 20:11:50 +08:00 committed by GitHub
parent 403d345577
commit 8d2d18c7f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 21 deletions

View File

@ -1,4 +1,4 @@
import React, { type FC } from 'react';
import React from 'react';
import { useLocale as useDumiLocale } from 'dumi';
import { css } from '@emotion/react';
import useLocale from '../../hooks/useLocale';
@ -42,7 +42,7 @@ const locales = {
},
};
const Homepage: FC = () => {
const Homepage: React.FC = () => {
const [locale] = useLocale(locales);
const { id: localeId } = useDumiLocale();
const localeStr = localeId === 'zh-CN' ? 'cn' : 'en';

View File

@ -1,6 +1,6 @@
import React, { type FC } from 'react';
import React from 'react';
const APITable: FC = () => {
const APITable: React.FC = () => {
// TODO: implement api table, depend on the new markdown data structure passed
return <>API Table</>;
};

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState, type FC } from 'react';
import React, { useEffect, useState } from 'react';
// @ts-ignore
import JsonML from 'jsonml.js/lib/utils';
// @ts-ignore
@ -36,7 +36,7 @@ function useShowRiddleButton() {
*/
export default function fromDumiProps<P extends object>(
WrappedComponent: React.ComponentType<P>,
): FC<IPreviewerProps> {
): React.FC<IPreviewerProps> {
const hoc = function DumiPropsAntdPreviewer(props: IPreviewerProps) {
const showRiddleButton = useShowRiddleButton();
const location = useLocation();

View File

@ -1,4 +1,4 @@
import React, { type FC } from 'react';
import React from 'react';
import { Col, Row } from 'antd';
import { css } from '@emotion/react';
import useSiteToken from '../../../hooks/useSiteToken';
@ -70,7 +70,7 @@ export type ResourceCardProps = {
resource: Resource;
};
const ResourceCard: FC<ResourceCardProps> = ({ resource }) => {
const ResourceCard: React.FC<ResourceCardProps> = ({ resource }) => {
const styles = useStyle();
const { title: titleStr, description, cover, src, official } = resource;
@ -105,7 +105,7 @@ export type ResourceCardsProps = {
resources: Resource[];
};
const ResourceCards: FC<ResourceCardsProps> = ({ resources }) => {
const ResourceCards: React.FC<ResourceCardsProps> = ({ resources }) => {
return (
<Row style={{ margin: '-12px -12px 0 -12px' }}>
{resources.map((item) => (

View File

@ -1,8 +1,8 @@
import React, { type FC } from 'react';
import React from 'react';
import { Skeleton, Space, Spin } from 'antd';
import { useLocation } from 'dumi';
const Loading: FC = () => {
const Loading: React.FC = () => {
const { pathname } = useLocation();
if (

View File

@ -1,4 +1,4 @@
import React, { type FC, useEffect, useMemo, useRef, useLayoutEffect } from 'react';
import React, { useEffect, useMemo, useRef, useLayoutEffect } from 'react';
import 'dayjs/locale/zh-cn';
import dayjs from 'dayjs';
import { useOutlet, useSearchParams, Helmet } from 'dumi';
@ -35,7 +35,7 @@ const locales = {
const RESPONSIVE_MOBILE = 768;
const DocLayout: FC = () => {
const DocLayout: React.FC = () => {
const outlet = useOutlet();
const location = useLocation();
const { pathname, search } = location;

View File

@ -1,4 +1,4 @@
import React, { type FC, useLayoutEffect } from 'react';
import React, { useLayoutEffect } from 'react';
import { useOutlet } from 'dumi';
import { ConfigProvider, theme as antdTheme } from 'antd';
import { ThemeConfig } from 'antd/es/config-provider/context';
@ -28,7 +28,7 @@ const getThemeString = (algorithm: typeof antdTheme.defaultAlgorithm) => {
return 'light';
};
const GlobalLayout: FC = () => {
const GlobalLayout: React.FC = () => {
const outlet = useOutlet();
const { pathname } = useLocation();

View File

@ -1,4 +1,4 @@
import React, { ReactNode, type FC, useMemo, useState, useLayoutEffect, useContext } from 'react';
import React, { ReactNode, useMemo, useState, useLayoutEffect, useContext } from 'react';
import { useIntl, useRouteMeta } from 'dumi';
import Footer from 'dumi/theme/slots/Footer';
import { Col, Typography, Avatar, Tooltip, Affix, Anchor } from 'antd';
@ -82,7 +82,8 @@ const useStyle = () => {
}
@media only screen and (max-width: ${token.screenLG}px) {
&, &.rtl {
&,
&.rtl {
padding-right: 48px;
padding-left: 48px;
}
@ -97,7 +98,7 @@ type AnchorItem = {
children?: AnchorItem[];
};
const Content: FC<{ children: ReactNode }> = ({ children }) => {
const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
const meta = useRouteMeta();
const { pathname } = useLocation();
const { formatMessage } = useIntl();

View File

@ -1,4 +1,4 @@
import React, { type FC, useContext } from 'react';
import React, { useContext } from 'react';
import { useSidebarData } from 'dumi';
import { Affix, Col, Menu } from 'antd';
import MobileMenu from 'rc-drawer';
@ -66,8 +66,8 @@ const useStyle = () => {
// Nest Category > Type > Article
&${antCls}-menu-inline {
${antCls}-menu-item-group-title {
padding-left: 60px;
margin-left: 4px;
padding-left: 60px;
${antCls}-row-rtl & {
padding-right: 60px;
@ -124,7 +124,7 @@ const useStyle = () => {
};
};
const Sidebar: FC = () => {
const Sidebar: React.FC = () => {
const sidebarData = useSidebarData();
const { isMobile } = useContext(SiteContext);
const styles = useStyle();