mirror of
https://github.com/ant-design/ant-design.git
synced 2025-07-24 15:38:45 +08:00
chore: back motion style
This commit is contained in:
parent
394aba4afe
commit
74ae7f68f0
126
components/drawer/style/motion.tsx
Normal file
126
components/drawer/style/motion.tsx
Normal file
@ -0,0 +1,126 @@
|
||||
import type { DrawerToken } from '.';
|
||||
import type { GenerateStyle } from '../../theme';
|
||||
|
||||
const genMotionStyle: GenerateStyle<DrawerToken> = (token: DrawerToken) => {
|
||||
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': {
|
||||
transform: 'translateX(-100%)',
|
||||
'&-active': {
|
||||
transform: 'translateX(0)',
|
||||
},
|
||||
},
|
||||
'&-leave': {
|
||||
transform: 'translateX(0)',
|
||||
'&-active': {
|
||||
transform: 'translateX(-100%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
// Right
|
||||
'&-right': [
|
||||
sharedPanelMotion,
|
||||
{
|
||||
'&-enter, &-appear': {
|
||||
transform: 'translateX(100%)',
|
||||
'&-active': {
|
||||
transform: 'translateX(0)',
|
||||
},
|
||||
},
|
||||
'&-leave': {
|
||||
transform: 'translateX(0)',
|
||||
'&-active': {
|
||||
transform: 'translateX(100%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
// Top
|
||||
'&-top': [
|
||||
sharedPanelMotion,
|
||||
{
|
||||
'&-enter, &-appear': {
|
||||
transform: 'translateY(-100%)',
|
||||
'&-active': {
|
||||
transform: 'translateY(0)',
|
||||
},
|
||||
},
|
||||
'&-leave': {
|
||||
transform: 'translateY(0)',
|
||||
'&-active': {
|
||||
transform: 'translateY(-100%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
// Bottom
|
||||
'&-bottom': [
|
||||
sharedPanelMotion,
|
||||
{
|
||||
'&-enter, &-appear': {
|
||||
transform: 'translateY(100%)',
|
||||
'&-active': {
|
||||
transform: 'translateY(0)',
|
||||
},
|
||||
},
|
||||
'&-leave': {
|
||||
transform: 'translateY(0)',
|
||||
'&-active': {
|
||||
transform: 'translateY(100%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default genMotionStyle;
|
Loading…
Reference in New Issue
Block a user