Skip to content

Commit 7f0df4c

Browse files
committed
remove notification x offset
1 parent 97eca40 commit 7f0df4c

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

assets/index.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
.@{notificationPrefixCls}-notice {
2222
@{vertical}: var(--notification-y, 0);
23-
@{horizontal}: var(--notification-x, 0);
23+
@{horizontal}: 0;
2424
transform-origin: @transformOrigin;
2525
}
2626

@@ -82,7 +82,7 @@
8282

8383
.@{notificationPrefixCls}-notice {
8484
@{vertical}: var(--notification-y, 0);
85-
left: var(--notification-x, 0);
85+
left: 0;
8686
transform-origin: @transformOrigin;
8787
}
8888

src/Notification.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export interface NotificationProps {
4444
actions?: React.ReactNode;
4545
closable?: ClosableType;
4646
offset?: {
47-
x: number;
4847
y: number;
4948
};
5049
notificationIndex?: number;
@@ -206,7 +205,6 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
206205
// ========================= Render =========================
207206
const mergedStyle: React.CSSProperties & {
208207
'--notification-index'?: number;
209-
'--notification-x'?: string;
210208
'--notification-y'?: string;
211209
} = {
212210
'--notification-index': mergedNotificationIndex,
@@ -215,7 +213,6 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
215213
};
216214

217215
if (mergedOffset) {
218-
mergedStyle['--notification-x'] = `${mergedOffset.x}px`;
219216
mergedStyle['--notification-y'] = `${mergedOffset.y}px`;
220217
}
221218

src/hooks/useListPosition/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { StackConfig } from '../../interface';
33
import useSizes from './useSizes';
44

55
export type NodePosition = {
6-
x: number;
76
y: number;
87
};
98

@@ -27,10 +26,10 @@ export default function useListPosition(
2726
.slice()
2827
.reverse()
2928
.forEach((config, index) => {
29+
// Walk from newest to oldest so each notice can be positioned after the ones below it.
3030
const key = String(config.key);
3131
const height = sizeMap[key]?.height ?? 0;
3232
const nodePosition = {
33-
x: 0,
3433
y: stack && index > 0 ? offsetY + (stack.offset ?? 0) - height : offsetY,
3534
};
3635

0 commit comments

Comments
 (0)