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

[pull] master from ant-design:master #31

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .dumi/pages/theme-editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ const CustomTheme = () => {
const storedConfig = localStorage.getItem(ANT_DESIGN_V5_THEME_EDITOR_THEME);
if (storedConfig) {
const themeConfig = JSON.parse(storedConfig);
const originThemeConfig = {
json: themeConfig,
text: undefined,
};
setThemeConfigContent(originThemeConfig);
setTheme(themeConfig);
}
}, []);
Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/builtins/IconSearch/Category.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Category: React.FC<CategoryProps> = (props) => {
const { icons, title, newIcons, theme } = props;
const intl = useIntl();
const [justCopied, setJustCopied] = React.useState<string | null>(null);
const copyId = React.useRef<NodeJS.Timeout | null>(null);
const copyId = React.useRef<ReturnType<typeof setTimeout> | null>(null);
const onCopied = React.useCallback((type: string, text: string) => {
message.success(
<span>
Expand Down
4 changes: 2 additions & 2 deletions .dumi/theme/builtins/TokenCompare/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import { TinyColor } from '@ctrl/tinycolor';
import { createStyles } from 'antd-style';
import tokenMeta from 'antd/es/version/token-meta.json';
import { theme, Space } from 'antd';
import { Space, theme } from 'antd';
import useLocale from '../../../hooks/useLocale';

const useStyle = createStyles(({ token, css }) => {
Expand All @@ -29,7 +29,7 @@ const useStyle = createStyles(({ token, css }) => {
display: flex;
align-items: center;
justify-content: center;

color: rgba(0,0,0,0.88);
border-right: 1px solid rgba(0, 0, 0, 0.1);
`,

Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/layouts/DocLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const DocLayout: React.FC = () => {
const location = useLocation();
const { pathname, search, hash } = location;
const [locale, lang] = useLocale(locales);
const timerRef = useRef<NodeJS.Timeout | null>(null);
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const { direction } = useContext(SiteContext);
const { loading } = useSiteData();

Expand Down
39 changes: 29 additions & 10 deletions .dumi/theme/slots/Header/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const locales = {

// ============================= Style =============================
const useStyle = createStyles(({ token }) => {
const { antCls, iconCls, fontFamily, headerHeight, menuItemBorder, colorPrimary } = token;
const { antCls, iconCls, fontFamily, headerHeight, menuItemBorder, colorPrimary, colorText } =
token;

return {
nav: css`
Expand All @@ -56,6 +57,17 @@ const useStyle = createStyles(({ token }) => {
left: 12px;
border-width: ${menuItemBorder}px;
}

a {
color: ${colorText};
}

a:before {
position: absolute;
inset: 0;
background-color: transparent;
content: "";
}
}

& ${antCls}-menu-submenu-title ${iconCls} {
Expand Down Expand Up @@ -97,7 +109,6 @@ const useStyle = createStyles(({ token }) => {

export interface NavigationProps extends SharedProps {
isMobile: boolean;
isClient: boolean;
responsive: null | 'narrow' | 'crowded';
directionText: string;
onLangChange: () => void;
Expand All @@ -106,7 +117,6 @@ export interface NavigationProps extends SharedProps {

export default ({
isZhCN,
isClient,
isMobile,
responsive,
directionText,
Expand Down Expand Up @@ -224,16 +234,21 @@ export default ({
),
key: 'docs/resources',
},
isZhCN &&
isClient &&
window.location.host !== 'ant-design.antgroup.com' &&
window.location.host !== 'ant-design.gitee.io'
isZhCN
? {
label: '国内镜像',
label: (
<a href="https://ant-design.antgroup.com" target="_blank" rel="noreferrer">
国内镜像
</a>
),
key: 'mirror',
children: [
{
label: <a href="https://ant-design.antgroup.com">官方镜像</a>,
label: (
<a href="https://ant-design.antgroup.com" target="_blank" rel="noreferrer">
官方镜像
</a>
),
icon: (
<img
alt="logo"
Expand All @@ -245,7 +260,11 @@ export default ({
key: 'antgroup',
},
{
label: <a href="https://ant-design.gitee.io">Gitee 镜像</a>,
label: (
<a href="https://ant-design.gitee.io" target="_blank" rel="noreferrer">
Gitee 镜像
</a>
),
icon: (
<img
alt="gitee"
Expand Down
5 changes: 1 addition & 4 deletions .dumi/theme/slots/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ interface HeaderState {

// ================================= Header =================================
const Header: React.FC = () => {
const [isClient, setIsClient] = React.useState(false);
const [, lang] = useLocale();

const { pkg } = useSiteData();
Expand All @@ -139,7 +138,7 @@ const Header: React.FC = () => {
searching: false,
});
const { direction, isMobile, updateSiteConfig } = useContext<SiteContextProps>(SiteContext);
const pingTimer = useRef<NodeJS.Timeout | null>(null);
const pingTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
const location = useLocation();
const { pathname, search } = location;

Expand All @@ -166,7 +165,6 @@ const Header: React.FC = () => {
}, [location]);

useEffect(() => {
setIsClient(typeof window !== 'undefined');
onWindowResize();
window.addEventListener('resize', onWindowResize);
pingTimer.current = ping((status) => {
Expand Down Expand Up @@ -273,7 +271,6 @@ const Header: React.FC = () => {
const sharedProps: SharedProps = {
isZhCN,
isRTL,
isClient,
};

const navigationNode = (
Expand Down
1 change: 0 additions & 1 deletion .dumi/theme/slots/Header/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export interface SharedProps {
isZhCN: boolean;
isRTL: boolean;
isClient: boolean;
}
28 changes: 28 additions & 0 deletions .github/workflows/pr-contributor-welcome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 当 PR 被合并时,留言欢迎加入共建群
name: PullRequest Contributor Welcome

on:
pull_request_target:
types:
- closed
paths:
- 'components/**'

jobs:
check-merged:
runs-on: ubuntu-latest
needs: read-file
if: github.event.pull_request.merged == true
steps:
- uses: actions-cool/maintain-one-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🎉 Thanks for contribution. Please feel free to join DingTalk Social Community (Provide the PR link please).

🎉 感谢参与贡献,欢迎扫码加入钉钉社区(进群后请提供 PR 地址)。

<img src="https://github.com/ant-design/ant-design/assets/5378891/e24c6080-bf38-4523-b1cd-f6c43ad7375f" height="200" />

<!-- WELCOME_CONTRIBUTION -->
body-include: '<!-- WELCOME_CONTRIBUTION -->'
2 changes: 1 addition & 1 deletion components/_util/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ActionButton: React.FC<ActionButtonProps> = (props) => {
};

React.useEffect(() => {
let timeoutId: NodeJS.Timer | null = null;
let timeoutId: ReturnType<typeof setTimeout> | null = null;
if (autoFocus) {
timeoutId = setTimeout(() => {
buttonRef.current?.focus();
Expand Down
2 changes: 1 addition & 1 deletion components/affix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class InternalAffix extends React.Component<InternalAffixProps, AffixState> {

private fixedNodeRef = createRef<HTMLDivElement>();

private timer: NodeJS.Timeout | null;
private timer: ReturnType<typeof setTimeout> | null;

context: ConfigConsumerProps;

Expand Down
32 changes: 18 additions & 14 deletions components/avatar/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ exports[`renders components/avatar/demo/badge.tsx extend context correctly 1`] =
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition: none;"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down Expand Up @@ -531,16 +533,18 @@ Array [
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition: none;"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down
32 changes: 18 additions & 14 deletions components/avatar/__tests__/__snapshots__/demo.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ exports[`renders components/avatar/demo/badge.tsx correctly 1`] = `
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition:none"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down Expand Up @@ -438,16 +440,18 @@ Array [
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition:none"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down
22 changes: 13 additions & 9 deletions components/badge/ScrollNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ const ScrollNumber = React.forwardRef<HTMLElement, ScrollNumberProps>((props, re
if (count && Number(count) % 1 === 0) {
const numberList = String(count).split('');

numberNodes = numberList.map((num, i) => (
<SingleNumber
prefixCls={prefixCls}
count={Number(count)}
value={num}
// eslint-disable-next-line react/no-array-index-key
key={numberList.length - i}
/>
));
numberNodes = (
<bdi>
{numberList.map((num, i) => (
<SingleNumber
prefixCls={prefixCls}
count={Number(count)}
value={num}
// eslint-disable-next-line react/no-array-index-key
key={numberList.length - i}
/>
))}
</bdi>
);
}

// allow specify the border
Expand Down
Loading
Loading