Skip to content

Commit f99b275

Browse files
Show info toast alert if user doesn't start the guided tour
1 parent cf646e7 commit f99b275

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

packages/react-core/src/demos/Animations/examples/Animations.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ const AnimationsPage: FunctionComponent = () => {
301301
];
302302

303303
// A function to create a kebab toggle for a specific row index
304-
const kebabToggle = (index) => (toggleRef: React.Ref<any>) => (
304+
const kebabToggle = (index: number) => (toggleRef: React.Ref<any>) => (
305305
<MenuToggle
306306
ref={toggleRef}
307307
variant="plain"
@@ -542,18 +542,6 @@ const AnimationsPage: FunctionComponent = () => {
542542
[]
543543
);
544544

545-
const startNotifications = () => {
546-
setTimeout(() => {
547-
addNotification();
548-
}, 1000);
549-
setTimeout(() => {
550-
addNotification();
551-
}, 5000);
552-
setTimeout(() => {
553-
addNotification();
554-
}, 9000);
555-
};
556-
557545
const onNavSelect = (
558546
_event: FormEvent<HTMLInputElement>,
559547
selectedItem: {
@@ -563,7 +551,6 @@ const AnimationsPage: FunctionComponent = () => {
563551
}
564552
) => {
565553
setActiveItem(selectedItem.itemId);
566-
setActiveGroup(selectedItem.groupId as string | null);
567554
};
568555

569556
const focusDrawer = (_event: any) => {
@@ -579,7 +566,23 @@ const AnimationsPage: FunctionComponent = () => {
579566

580567
const closeStartTourModal = (startTour = false) => {
581568
setShowStartTourModal(false);
582-
startTour ? onStart() : startNotifications();
569+
if (startTour) {
570+
onStart();
571+
} else {
572+
setNotifications((prev) => [
573+
{
574+
id: `new-notification-${prev.length + 1}`,
575+
title: 'Explore animations',
576+
message: 'When you’re ready to take a tour of PatternFly’s exciting, new animations, refresh this page.',
577+
variant: AlertVariant.info,
578+
timeout: 8000,
579+
timeoutAnimation: 8000,
580+
isNew: true,
581+
isRead: false
582+
},
583+
...prev
584+
]);
585+
}
583586
};
584587

585588
return (

0 commit comments

Comments
 (0)