Skip to content

Commit e786276

Browse files
committed
refactor: split notification motion sections
1 parent 10872d7 commit e786276

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/NotificationList/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,15 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
182182
[configList],
183183
);
184184

185-
// ========================= Motion =========================
185+
// ===================== Motion Config ======================
186186
const placementMotion = typeof motion === 'function' ? motion(placement) : motion;
187+
188+
// ====================== Stack State =======================
187189
const [stackEnabled, { offset, threshold }] = useStack(stackConfig);
188190
const [listHovering, setListHovering] = React.useState(false);
189191
const expanded = stackEnabled && (listHovering || keys.length <= threshold);
192+
193+
// ====================== Stack Layout ======================
190194
const stackPosition = React.useMemo<StackConfig | undefined>(() => {
191195
if (!stackEnabled || expanded) {
192196
return undefined;
@@ -198,6 +202,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
198202
};
199203
}, [expanded, offset, stackEnabled, threshold]);
200204

205+
// ====================== List Measure ======================
201206
const [gap, setGap] = React.useState(0);
202207
const contentRef = React.useRef<HTMLDivElement>(null);
203208
const [notificationPosition, setNodeSize, totalHeight] = useListPosition(
@@ -214,6 +219,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
214219
return;
215220
}
216221

222+
// CSS gap impacts stack offset and total list height calculation.
217223
const { gap: cssGap, rowGap } = window.getComputedStyle(listNode);
218224
const nextGap = parseFloat(rowGap || cssGap) || 0;
219225

0 commit comments

Comments
 (0)