2022-05-17 20:15:34 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
|
|
|
import { Keyframes } from '@ant-design/cssinjs';
|
|
|
|
import type { GenerateStyle } from '../../_util/theme';
|
|
|
|
import type { NotificationToken } from '.';
|
|
|
|
|
|
|
|
const genNotificationPlacementStyle: GenerateStyle<NotificationToken, CSSObject> = token => {
|
2022-05-20 17:40:03 +08:00
|
|
|
const { componentCls, width, notificationMarginEdge } = token;
|
2022-05-17 20:15:34 +08:00
|
|
|
|
|
|
|
const notificationTopFadeIn = new Keyframes('antNotificationTopFadeIn', {
|
|
|
|
'0%': {
|
2022-05-20 17:40:03 +08:00
|
|
|
marginTop: '-100%',
|
|
|
|
opacity: 0,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
2022-05-20 17:40:03 +08:00
|
|
|
marginTop: 0,
|
|
|
|
opacity: 1,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const notificationBottomFadeIn = new Keyframes('antNotificationBottomFadeIn', {
|
|
|
|
'0%': {
|
2022-05-20 17:40:03 +08:00
|
|
|
marginBottom: '-100%',
|
|
|
|
opacity: 0,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
2022-05-20 17:40:03 +08:00
|
|
|
marginBottom: 0,
|
|
|
|
opacity: 1,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const notificationLeftFadeIn = new Keyframes('antNotificationLeftFadeIn', {
|
|
|
|
'0%': {
|
|
|
|
right: {
|
|
|
|
_skip_check_: true,
|
2022-05-20 17:40:03 +08:00
|
|
|
value: width,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
2022-05-20 17:40:03 +08:00
|
|
|
opacity: 0,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
right: {
|
|
|
|
_skip_check_: true,
|
2022-05-20 17:40:03 +08:00
|
|
|
value: 0,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
2022-05-20 17:40:03 +08:00
|
|
|
opacity: 1,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
[`&${componentCls}-top, &${componentCls}-bottom`]: {
|
2022-05-20 17:40:03 +08:00
|
|
|
marginInline: 0,
|
2022-05-17 20:15:34 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`&${componentCls}-top`]: {
|
|
|
|
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]:
|
|
|
|
{
|
|
|
|
animationName: notificationTopFadeIn,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&${componentCls}-bottom`]: {
|
|
|
|
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]:
|
|
|
|
{
|
|
|
|
animationName: notificationBottomFadeIn,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&${componentCls}-topLeft, &${componentCls}-bottomLeft`]: {
|
2022-05-20 17:40:03 +08:00
|
|
|
marginInlineEnd: 0,
|
2022-05-17 20:15:34 +08:00
|
|
|
marginInlineStart: notificationMarginEdge,
|
|
|
|
|
|
|
|
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]:
|
|
|
|
{
|
|
|
|
animationName: notificationLeftFadeIn,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
export default genNotificationPlacementStyle;
|