Skip to content

Conversation

@dHIM24
Copy link
Contributor

@dHIM24 dHIM24 commented Dec 8, 2025

NotificationManager
  • NotificationManager корректно наследует position и даёт управлять отступом offset для верхнего и нижнего размещения.

Чек лист

  • Задача сформулирована и описана в JIRA
  • В названии ветки есть айдишник задачи в JIRA (fix/DS-1234), ссылку прикреплять не надо
  • У реквеста осмысленное название feat(...) или fix(...) по conventional commits (https://www.conventionalcommits.org)
  • Код покрыт тестами и протестирован в различных браузерах
  • Добавленные пропсы добавлены в демки и описаны в документации
  • К реквесту добавлен changeset

Если есть визуальные изменения

  • Прикреплено изображение было/стало
2025-12-08.11.16.25.mov

Код из песочницы:

render(() => {
    const [notifications, setNotifications] = React.useState([]);

    const [count, setCount] = React.useState(1);

    const getColorBadge = (num) => {
        if (num % 3 === 1) {
            return 'positive';
        } else if (num % 3 === 2) {
            return 'attention';
        } else if (num % 3 === 0) {
            return 'negative';
        }
    };

    const addNotification = () => {
        const newNotification = (
            <Notification
                badge={getColorBadge(count)}
                title={`Уведомление #${count}`}
                autoCloseDelay={3000}
                id={count.toString()}
                key={count.toString()}
                zIndex={1000 + count}
            >
                Описание уведомления
            </Notification>
        );

        setNotifications([...notifications, newNotification]);
        setCount((val) => val + 1);
    };

    const removeNotification = React.useCallback((id) => {
        /**
         * Обратите внимание, что актуальный массив нотификаций
         * нужно брать из аргументов функции обновления состояния.
         */
        setNotifications((actualNotifications) =>
            actualNotifications.filter((notification) => notification.props.id !== id),
        );
    }, []);

    return (
        <div>
            <Button onClick={addNotification}>Показать уведомление</Button>
            <NotificationManager
                notifications={notifications}
                onRemoveNotification={removeNotification}
                position='bottom' // 'top' || 'bottom
            />
        </div>
    );
});

@changeset-bot
Copy link

changeset-bot bot commented Dec 8, 2025

🦋 Changeset detected

Latest commit: d251b22

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@alfalab/core-components-notification-manager Patch
@alfalab/core-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Demo build

https://core-ds.github.io/core-components/1974

@dHIM24 dHIM24 requested a review from Oladii December 8, 2025 08:28
@dHIM24 dHIM24 changed the title Исправить отображение position: bottom в компоненте fix(notification-manager): Исправить отображение position: bottom в компоненте [DS-13776] Dec 8, 2025
@dHIM24 dHIM24 marked this pull request as ready for review December 8, 2025 08:51
@coveralls
Copy link

coveralls commented Dec 8, 2025

Pull Request Test Coverage Report for Build 20022282994

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 79.832%

Totals Coverage Status
Change from base Build 19958149299: 0.01%
Covered Lines: 9703
Relevant Lines: 11391

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants