Skip to content

Commit

Permalink
Merge branch 'master' into feat/form-md-getValueProps
Browse files Browse the repository at this point in the history
  • Loading branch information
vagusX authored Dec 18, 2023
2 parents 5c901e5 + e88d6e6 commit 61f547c
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
39 changes: 39 additions & 0 deletions .dumi/theme/builtins/Container/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* copied: https://github.com/arvinxx/dumi-theme-antd-style/tree/master/src/builtins/Container
*/
import * as React from 'react';
import { Alert } from 'antd';
import { type FC, type ReactNode } from 'react';
import useStyles from './style';

const Container: FC<{
type: 'info' | 'warning' | 'success' | 'error';
title?: string;
children: ReactNode;
}> = ({ type, title, children }) => {
const { styles, cx } = useStyles();

return (
<div data-type={type} className={styles.container}>
<Alert
showIcon
type={type}
message={title || type.toUpperCase()}
description={
<div
className={cx(
styles.desc,
// 为了让 markdown 的样式生效,需要在这里添加一个额外的 class
'markdown',
)}
>
{children}
</div>
}
className={styles.alert}
/>
</div>
);
};

export default Container;
22 changes: 22 additions & 0 deletions .dumi/theme/builtins/Container/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createStyles } from 'antd-style';

const useStyles = createStyles(({ prefixCls, css }) => ({
container: css`
margin: 8px 0;
`,

alert: css`
.${prefixCls}-alert-message {
font-weight: bold;
}
`,

/* 使用 `&&` 加一点点权重 */
desc: css`
&& p {
margin: 0;
}
`,
}));

export default useStyles;
6 changes: 4 additions & 2 deletions .dumi/theme/slots/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ const Header: React.FC = () => {
// Mirror url must have `/`, we add this for compatible
const urlObj = new URL(currentUrl.replace(window.location.origin, url));
if (urlObj.host.includes('antgroup')) {
window.location.href = `${urlObj.href.replace(/\/$/, '')}/`;
urlObj.pathname = `${urlObj.pathname.replace(/\/$/, '')}/`;
window.location.href = urlObj.toString();
} else {
window.location.href = urlObj.href.replace(/\/$/, '');
}
window.location.href = urlObj.href.replace(/\/$/, '');
}, []);

const onLangChange = useCallback(() => {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/visual-regression-diff-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: 👀 Visual Regression Diff Start

on:
pull_request:
pull_request_target:
branches: [master, feature]
types: [opened, synchronize, reopened]

Expand Down
2 changes: 1 addition & 1 deletion components/tag/style/presetCmp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { genPresetColor, genSubStyleComponent } from '../../theme/internal';
// ============================== Preset ==============================
const genPresetStyle = (token: TagToken) =>
genPresetColor(token, (colorKey, { textColor, lightBorderColor, lightColor, darkColor }) => ({
[`${token.componentCls}-${colorKey}`]: {
[`${token.componentCls}${token.componentCls}-${colorKey}`]: {
color: textColor,
background: lightColor,
borderColor: lightBorderColor,
Expand Down
2 changes: 1 addition & 1 deletion components/tag/style/statusCmp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const genTagStatusStyle = (
): CSSInterpolation => {
const capitalizedCssVariableType = capitalize<CssVariableType>(cssVariableType);
return {
[`${token.componentCls}-${status}`]: {
[`${token.componentCls}${token.componentCls}-${status}`]: {
color: token[`color${cssVariableType}`],
background: token[`color${capitalizedCssVariableType}Bg`],
borderColor: token[`color${capitalizedCssVariableType}Border`],
Expand Down

0 comments on commit 61f547c

Please # to comment.