You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
2 years ago
|
import type { TabsToken } from '.';
|
||
2 years ago
|
import { initSlideMotion } from '../../style/motion';
|
||
2 years ago
|
import type { GenerateStyle } from '../../theme/internal';
|
||
2 years ago
|
|
||
2 years ago
|
const genMotionStyle: GenerateStyle<TabsToken> = (token) => {
|
||
2 years ago
|
const { componentCls, motionDurationSlow } = token;
|
||
|
|
||
2 years ago
|
return [
|
||
|
{
|
||
|
[componentCls]: {
|
||
|
[`${componentCls}-switch`]: {
|
||
|
'&-appear, &-enter': {
|
||
|
transition: 'none',
|
||
2 years ago
|
|
||
2 years ago
|
'&-start': {
|
||
|
opacity: 0,
|
||
|
},
|
||
|
'&-active': {
|
||
|
opacity: 1,
|
||
|
transition: `opacity ${motionDurationSlow}`,
|
||
|
},
|
||
2 years ago
|
},
|
||
|
|
||
2 years ago
|
'&-leave': {
|
||
|
position: 'absolute',
|
||
|
transition: 'none',
|
||
|
inset: 0,
|
||
2 years ago
|
|
||
2 years ago
|
'&-start': {
|
||
|
opacity: 1,
|
||
|
},
|
||
|
'&-active': {
|
||
|
opacity: 0,
|
||
|
transition: `opacity ${motionDurationSlow}`,
|
||
|
},
|
||
2 years ago
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
2 years ago
|
|
||
|
// Follow code may reuse in other components
|
||
|
[initSlideMotion(token, 'slide-up'), initSlideMotion(token, 'slide-down')],
|
||
|
];
|
||
2 years ago
|
};
|
||
|
|
||
|
export default genMotionStyle;
|