mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
b9531997a8
Signed-off-by: MadCcc <madccc@foxmail.com> Co-authored-by: MadCcc <madccc@foxmail.com>
135 lines
3.1 KiB
TypeScript
135 lines
3.1 KiB
TypeScript
import type { DrawerToken } from '.';
|
|
import type { GenerateStyle } from '../../theme/internal';
|
|
|
|
const genMotionStyle: GenerateStyle<DrawerToken> = (token) => {
|
|
const { componentCls, motionDurationSlow } = token;
|
|
|
|
const sharedPanelMotion = {
|
|
'&-enter, &-appear, &-leave': {
|
|
'&-start': {
|
|
transition: 'none',
|
|
},
|
|
|
|
'&-active': {
|
|
transition: `all ${motionDurationSlow}`,
|
|
},
|
|
},
|
|
};
|
|
|
|
return {
|
|
[componentCls]: {
|
|
// ======================== Mask ========================
|
|
[`${componentCls}-mask-motion`]: {
|
|
'&-enter, &-appear, &-leave': {
|
|
'&-active': {
|
|
transition: `all ${motionDurationSlow}`,
|
|
},
|
|
},
|
|
|
|
'&-enter, &-appear': {
|
|
opacity: 0,
|
|
'&-active': {
|
|
opacity: 1,
|
|
},
|
|
},
|
|
|
|
'&-leave': {
|
|
opacity: 1,
|
|
'&-active': {
|
|
opacity: 0,
|
|
},
|
|
},
|
|
},
|
|
|
|
// ======================= Panel ========================
|
|
[`${componentCls}-panel-motion`]: {
|
|
// Left
|
|
'&-left': [
|
|
sharedPanelMotion,
|
|
{
|
|
'&-enter, &-appear': {
|
|
'&-start': {
|
|
transform: 'translateX(-100%) !important',
|
|
},
|
|
'&-active': {
|
|
transform: 'translateX(0)',
|
|
},
|
|
},
|
|
'&-leave': {
|
|
transform: 'translateX(0)',
|
|
'&-active': {
|
|
transform: 'translateX(-100%)',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
|
|
// Right
|
|
'&-right': [
|
|
sharedPanelMotion,
|
|
{
|
|
'&-enter, &-appear': {
|
|
'&-start': {
|
|
transform: 'translateX(100%) !important',
|
|
},
|
|
'&-active': {
|
|
transform: 'translateX(0)',
|
|
},
|
|
},
|
|
'&-leave': {
|
|
transform: 'translateX(0)',
|
|
'&-active': {
|
|
transform: 'translateX(100%)',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
|
|
// Top
|
|
'&-top': [
|
|
sharedPanelMotion,
|
|
{
|
|
'&-enter, &-appear': {
|
|
'&-start': {
|
|
transform: 'translateY(-100%) !important',
|
|
},
|
|
'&-active': {
|
|
transform: 'translateY(0)',
|
|
},
|
|
},
|
|
'&-leave': {
|
|
transform: 'translateY(0)',
|
|
'&-active': {
|
|
transform: 'translateY(-100%)',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
|
|
// Bottom
|
|
'&-bottom': [
|
|
sharedPanelMotion,
|
|
{
|
|
'&-enter, &-appear': {
|
|
'&-start': {
|
|
transform: 'translateY(100%) !important',
|
|
},
|
|
'&-active': {
|
|
transform: 'translateY(0)',
|
|
},
|
|
},
|
|
'&-leave': {
|
|
transform: 'translateY(0)',
|
|
'&-active': {
|
|
transform: 'translateY(100%)',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
export default genMotionStyle;
|