mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
2fe9b46bc1
* feat: Button support lineHeight token * refactor: rm format * chore: code clean * chore: fix test
81 lines
1.9 KiB
TypeScript
81 lines
1.9 KiB
TypeScript
import type { ButtonToken } from './token';
|
|
import type { GenerateStyle } from '../../theme/internal';
|
|
|
|
const genButtonBorderStyle = (buttonTypeCls: string, borderColor: string) => ({
|
|
// Border
|
|
[`> span, > ${buttonTypeCls}`]: {
|
|
'&:not(:last-child)': {
|
|
[`&, & > ${buttonTypeCls}`]: {
|
|
'&:not(:disabled)': {
|
|
borderInlineEndColor: borderColor,
|
|
},
|
|
},
|
|
},
|
|
|
|
'&:not(:first-child)': {
|
|
[`&, & > ${buttonTypeCls}`]: {
|
|
'&:not(:disabled)': {
|
|
borderInlineStartColor: borderColor,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
const genGroupStyle: GenerateStyle<ButtonToken> = (token) => {
|
|
const { componentCls, fontSize, lineWidth, groupBorderColor, colorErrorHover } = token;
|
|
|
|
return {
|
|
[`${componentCls}-group`]: [
|
|
{
|
|
position: 'relative',
|
|
display: 'inline-flex',
|
|
|
|
// Border
|
|
[`> span, > ${componentCls}`]: {
|
|
'&:not(:last-child)': {
|
|
[`&, & > ${componentCls}`]: {
|
|
borderStartEndRadius: 0,
|
|
borderEndEndRadius: 0,
|
|
},
|
|
},
|
|
|
|
'&:not(:first-child)': {
|
|
marginInlineStart: token.calc(lineWidth).mul(-1).equal(),
|
|
|
|
[`&, & > ${componentCls}`]: {
|
|
borderStartStartRadius: 0,
|
|
borderEndStartRadius: 0,
|
|
},
|
|
},
|
|
},
|
|
|
|
[componentCls]: {
|
|
position: 'relative',
|
|
zIndex: 1,
|
|
|
|
[`&:hover,
|
|
&:focus,
|
|
&:active`]: {
|
|
zIndex: 2,
|
|
},
|
|
|
|
'&[disabled]': {
|
|
zIndex: 0,
|
|
},
|
|
},
|
|
|
|
[`${componentCls}-icon-only`]: {
|
|
fontSize,
|
|
},
|
|
},
|
|
|
|
// Border Color
|
|
genButtonBorderStyle(`${componentCls}-primary`, groupBorderColor),
|
|
genButtonBorderStyle(`${componentCls}-danger`, colorErrorHover),
|
|
],
|
|
};
|
|
};
|
|
|
|
export default genGroupStyle;
|