Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: feature merge master again #43900

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dumi/pages/index/components/ComponentsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default function ComponentsList() {
[isMobile],
);

const ComponentItem = ({ title, node, type, index }: ComponentItemProps) => {
const ComponentItem: React.FC<ComponentItemProps> = ({ title, node, type, index }) => {
const tagColor = type === 'new' ? 'processing' : 'warning';
const tagText = type === 'new' ? locale.new : locale.update;

Expand Down
15 changes: 8 additions & 7 deletions .dumi/pages/index/components/Theme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,14 @@ export default function Theme() {
/>
</Sider>
<Layout className={styles.transBg} style={{ padding: '0 24px 24px' }}>
<Breadcrumb style={{ margin: '16px 0' }}>
<Breadcrumb.Item>
<HomeOutlined />
</Breadcrumb.Item>
<Breadcrumb.Item menu={{ items: subMenuItems }}>Design</Breadcrumb.Item>
<Breadcrumb.Item>Themes</Breadcrumb.Item>
</Breadcrumb>
<Breadcrumb
style={{ margin: '16px 0' }}
items={[
{ title: <HomeOutlined /> },
{ title: 'Design', menu: { items: subMenuItems } },
{ title: 'Themes' },
]}
/>
<Content>
<Typography.Title level={2}>{locale.customizeTheme}</Typography.Title>
<Card
Expand Down
10 changes: 9 additions & 1 deletion .dumi/theme/common/PrevAndNext.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
import { createStyles } from 'antd-style';
import type { ReactElement } from 'react';
import React, { useMemo } from 'react';
import React, { useMemo, useContext } from 'react';
import classNames from 'classnames';
import type { MenuItemType } from 'antd/es/menu/hooks/useItems';
import type { MenuProps } from 'antd';
import useMenu from '../../hooks/useMenu';
import SiteContext from '../slots/SiteContext';
import type { SiteContextProps } from '../slots/SiteContext';

const useStyle = createStyles(({ token, css }) => {
const { colorSplit, iconCls, fontSizeIcon } = token;
Expand Down Expand Up @@ -111,6 +113,8 @@ const PrevAndNext: React.FC<{ rtl?: boolean }> = ({ rtl }) => {

const [menuItems, selectedKey] = useMenu({ before, after });

const { isMobile } = useContext<SiteContextProps>(SiteContext);

const [prev, next] = useMemo(() => {
const flatMenu = flattenMenu(menuItems);
if (!flatMenu) {
Expand All @@ -128,6 +132,10 @@ const PrevAndNext: React.FC<{ rtl?: boolean }> = ({ rtl }) => {
];
}, [menuItems, selectedKey]);

if (isMobile) {
return null;
}

return (
<section className={styles.prevNextNav}>
{prev &&
Expand Down
29 changes: 13 additions & 16 deletions .dumi/theme/slots/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ const useStyle = createStyles(({ token, css }) => {
}
}
`,
listMobile: css`
margin: 1em 0 !important;
`,
toc: css`
${antCls}-anchor {
${antCls}-anchor-link-title {
Expand Down Expand Up @@ -114,7 +117,7 @@ const AvatarPlaceholder: React.FC<{ num?: number }> = ({ num = 3 }) => (
</li>
);

const AuthorAvatar = ({ name, avatar }: { name: string; avatar: string }) => {
const AuthorAvatar: React.FC<{ name: string; avatar: string }> = ({ name, avatar }) => {
const [loading, setLoading] = useState(true);
const [error, setError] = useState(false);
useLayoutEffect(() => {
Expand All @@ -123,9 +126,12 @@ const AuthorAvatar = ({ name, avatar }: { name: string; avatar: string }) => {
img.onload = () => setLoading(false);
img.onerror = () => setError(true);
}, []);

if (error) return null;
if (loading) return <Skeleton.Avatar size="small" active />;
if (error) {
return null;
}
if (loading) {
return <Skeleton.Avatar size="small" active />;
}
return (
<Avatar size="small" src={avatar} alt={name}>
{name}
Expand All @@ -140,7 +146,7 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
const { formatMessage } = useIntl();
const { styles } = useStyle();
const token = useTheme();
const { direction } = useContext(SiteContext);
const { direction, isMobile } = useContext(SiteContext);

const [showDebug, setShowDebug] = useLayoutState(false);
const debugDemos = useMemo(
Expand Down Expand Up @@ -178,15 +184,6 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {

const isRTL = direction === 'rtl';

// support custom author info in frontmatter
// e.g.
// ---
// author:
// - name: qixian
// avatar: https://avatars.githubusercontent.com/u/11746742?v=4
// - name: yutingzhao1991
// avatar: https://avatars.githubusercontent.com/u/5378891?v=4
// ---
const mergedAuthorInfos = useMemo(() => {
const { author } = meta.frontmatter;
if (!author) {
Expand Down Expand Up @@ -286,10 +283,10 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
)}
{meta.frontmatter.filename && (
<ContributorsList
cache
repo="ant-design"
owner="ant-design"
className={styles.contributorsList}
cache
className={classNames(styles.contributorsList, { [styles.listMobile]: isMobile })}
fileName={meta.frontmatter.filename}
renderItem={(item, loading) => {
if (!item || loading) {
Expand Down
1 change: 0 additions & 1 deletion components/modal/useModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ function useModal(): readonly [
}),
[],
);

return [fns, <ElementsHolder key="modal-holder" ref={holderRef} />] as const;
}

Expand Down