mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
type: remove type FC in site (#38959)
This commit is contained in:
parent
403d345577
commit
8d2d18c7f3
@ -1,4 +1,4 @@
|
|||||||
import React, { type FC } from 'react';
|
import React from 'react';
|
||||||
import { useLocale as useDumiLocale } from 'dumi';
|
import { useLocale as useDumiLocale } from 'dumi';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import useLocale from '../../hooks/useLocale';
|
import useLocale from '../../hooks/useLocale';
|
||||||
@ -42,7 +42,7 @@ const locales = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const Homepage: FC = () => {
|
const Homepage: React.FC = () => {
|
||||||
const [locale] = useLocale(locales);
|
const [locale] = useLocale(locales);
|
||||||
const { id: localeId } = useDumiLocale();
|
const { id: localeId } = useDumiLocale();
|
||||||
const localeStr = localeId === 'zh-CN' ? 'cn' : 'en';
|
const localeStr = localeId === 'zh-CN' ? 'cn' : 'en';
|
||||||
|
@ -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
|
// TODO: implement api table, depend on the new markdown data structure passed
|
||||||
return <>API Table</>;
|
return <>API Table</>;
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, type FC } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import JsonML from 'jsonml.js/lib/utils';
|
import JsonML from 'jsonml.js/lib/utils';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -36,7 +36,7 @@ function useShowRiddleButton() {
|
|||||||
*/
|
*/
|
||||||
export default function fromDumiProps<P extends object>(
|
export default function fromDumiProps<P extends object>(
|
||||||
WrappedComponent: React.ComponentType<P>,
|
WrappedComponent: React.ComponentType<P>,
|
||||||
): FC<IPreviewerProps> {
|
): React.FC<IPreviewerProps> {
|
||||||
const hoc = function DumiPropsAntdPreviewer(props: IPreviewerProps) {
|
const hoc = function DumiPropsAntdPreviewer(props: IPreviewerProps) {
|
||||||
const showRiddleButton = useShowRiddleButton();
|
const showRiddleButton = useShowRiddleButton();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { type FC } from 'react';
|
import React from 'react';
|
||||||
import { Col, Row } from 'antd';
|
import { Col, Row } from 'antd';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import useSiteToken from '../../../hooks/useSiteToken';
|
import useSiteToken from '../../../hooks/useSiteToken';
|
||||||
@ -70,7 +70,7 @@ export type ResourceCardProps = {
|
|||||||
resource: Resource;
|
resource: Resource;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ResourceCard: FC<ResourceCardProps> = ({ resource }) => {
|
const ResourceCard: React.FC<ResourceCardProps> = ({ resource }) => {
|
||||||
const styles = useStyle();
|
const styles = useStyle();
|
||||||
|
|
||||||
const { title: titleStr, description, cover, src, official } = resource;
|
const { title: titleStr, description, cover, src, official } = resource;
|
||||||
@ -105,7 +105,7 @@ export type ResourceCardsProps = {
|
|||||||
resources: Resource[];
|
resources: Resource[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const ResourceCards: FC<ResourceCardsProps> = ({ resources }) => {
|
const ResourceCards: React.FC<ResourceCardsProps> = ({ resources }) => {
|
||||||
return (
|
return (
|
||||||
<Row style={{ margin: '-12px -12px 0 -12px' }}>
|
<Row style={{ margin: '-12px -12px 0 -12px' }}>
|
||||||
{resources.map((item) => (
|
{resources.map((item) => (
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React, { type FC } from 'react';
|
import React from 'react';
|
||||||
import { Skeleton, Space, Spin } from 'antd';
|
import { Skeleton, Space, Spin } from 'antd';
|
||||||
import { useLocation } from 'dumi';
|
import { useLocation } from 'dumi';
|
||||||
|
|
||||||
const Loading: FC = () => {
|
const Loading: React.FC = () => {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -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/locale/zh-cn';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useOutlet, useSearchParams, Helmet } from 'dumi';
|
import { useOutlet, useSearchParams, Helmet } from 'dumi';
|
||||||
@ -35,7 +35,7 @@ const locales = {
|
|||||||
|
|
||||||
const RESPONSIVE_MOBILE = 768;
|
const RESPONSIVE_MOBILE = 768;
|
||||||
|
|
||||||
const DocLayout: FC = () => {
|
const DocLayout: React.FC = () => {
|
||||||
const outlet = useOutlet();
|
const outlet = useOutlet();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { pathname, search } = location;
|
const { pathname, search } = location;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { type FC, useLayoutEffect } from 'react';
|
import React, { useLayoutEffect } from 'react';
|
||||||
import { useOutlet } from 'dumi';
|
import { useOutlet } from 'dumi';
|
||||||
import { ConfigProvider, theme as antdTheme } from 'antd';
|
import { ConfigProvider, theme as antdTheme } from 'antd';
|
||||||
import { ThemeConfig } from 'antd/es/config-provider/context';
|
import { ThemeConfig } from 'antd/es/config-provider/context';
|
||||||
@ -28,7 +28,7 @@ const getThemeString = (algorithm: typeof antdTheme.defaultAlgorithm) => {
|
|||||||
return 'light';
|
return 'light';
|
||||||
};
|
};
|
||||||
|
|
||||||
const GlobalLayout: FC = () => {
|
const GlobalLayout: React.FC = () => {
|
||||||
const outlet = useOutlet();
|
const outlet = useOutlet();
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
|
@ -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 { useIntl, useRouteMeta } from 'dumi';
|
||||||
import Footer from 'dumi/theme/slots/Footer';
|
import Footer from 'dumi/theme/slots/Footer';
|
||||||
import { Col, Typography, Avatar, Tooltip, Affix, Anchor } from 'antd';
|
import { Col, Typography, Avatar, Tooltip, Affix, Anchor } from 'antd';
|
||||||
@ -82,7 +82,8 @@ const useStyle = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: ${token.screenLG}px) {
|
@media only screen and (max-width: ${token.screenLG}px) {
|
||||||
&, &.rtl {
|
&,
|
||||||
|
&.rtl {
|
||||||
padding-right: 48px;
|
padding-right: 48px;
|
||||||
padding-left: 48px;
|
padding-left: 48px;
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ type AnchorItem = {
|
|||||||
children?: AnchorItem[];
|
children?: AnchorItem[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const Content: FC<{ children: ReactNode }> = ({ children }) => {
|
const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
|
||||||
const meta = useRouteMeta();
|
const meta = useRouteMeta();
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { type FC, useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { useSidebarData } from 'dumi';
|
import { useSidebarData } from 'dumi';
|
||||||
import { Affix, Col, Menu } from 'antd';
|
import { Affix, Col, Menu } from 'antd';
|
||||||
import MobileMenu from 'rc-drawer';
|
import MobileMenu from 'rc-drawer';
|
||||||
@ -66,8 +66,8 @@ const useStyle = () => {
|
|||||||
// Nest Category > Type > Article
|
// Nest Category > Type > Article
|
||||||
&${antCls}-menu-inline {
|
&${antCls}-menu-inline {
|
||||||
${antCls}-menu-item-group-title {
|
${antCls}-menu-item-group-title {
|
||||||
padding-left: 60px;
|
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
|
padding-left: 60px;
|
||||||
|
|
||||||
${antCls}-row-rtl & {
|
${antCls}-row-rtl & {
|
||||||
padding-right: 60px;
|
padding-right: 60px;
|
||||||
@ -124,7 +124,7 @@ const useStyle = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const Sidebar: FC = () => {
|
const Sidebar: React.FC = () => {
|
||||||
const sidebarData = useSidebarData();
|
const sidebarData = useSidebarData();
|
||||||
const { isMobile } = useContext(SiteContext);
|
const { isMobile } = useContext(SiteContext);
|
||||||
const styles = useStyle();
|
const styles = useStyle();
|
||||||
|
Loading…
Reference in New Issue
Block a user