@ant-design/x
Version:
Craft AI-driven interfaces effortlessly
78 lines • 2.12 kB
JavaScript
import { mergeToken } from '@ant-design/cssinjs-utils';
import { blinkMotion, genCollapseMotion } from "../../style";
import { genStyleHooks } from "../../theme/genStyleUtils";
const genThinkStyle = token => {
const {
componentCls,
paddingXS,
paddingSM,
marginSM,
colorTextSecondary,
colorTextDescription,
fontSize,
fontSizeHeading5,
fontSizeSM,
lineHeight,
colorBorder,
lineWidth,
calc
} = token;
return {
[componentCls]: {
[`${componentCls}-status-wrapper`]: {
width: 'fit-content',
display: 'flex',
flexDirection: 'row',
gridGap: paddingXS,
alignItems: 'center',
fontSize: fontSize,
color: colorTextSecondary,
lineHeight: lineHeight,
cursor: 'pointer'
},
[`${componentCls}-status-icon`]: {
fontSize: fontSizeHeading5,
display: 'flex'
},
[`${componentCls}-status-text`]: {
lineHeight: token.lineHeight,
fontSize: token.fontSize
},
[`${componentCls}-status-down-icon`]: {
fontSize: fontSizeSM,
svg: {
transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`
}
},
[`${componentCls}-content`]: {
marginTop: marginSM,
width: '100%',
color: colorTextDescription,
paddingInlineStart: paddingSM,
borderInlineStart: `${calc(lineWidth).mul(2).equal()} solid ${colorBorder}`
},
[`&${componentCls}-rtl`]: {
direction: 'rtl'
}
}
};
};
export const prepareComponentToken = token => {
const {
colorTextDescription,
colorTextBase
} = token;
const colorTextBlinkDefault = colorTextDescription;
const colorTextBlink = colorTextBase;
return {
colorTextBlinkDefault,
colorTextBlink
};
};
export default genStyleHooks('Think', token => {
const compToken = mergeToken(token, {});
const {
componentCls
} = token;
return [genThinkStyle(compToken), genCollapseMotion(compToken), blinkMotion(compToken, `${componentCls}-motion-blink`)];
}, prepareComponentToken);