Skip to content

Commit 3a3b68a

Browse files
chore: fix demo (theme and transition selector) (#564)
closes #562
1 parent 9044d21 commit 3a3b68a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

demo/src/components/Demo/Demo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Demo = () => {
4646
<div className={css.description}>{packageJson.description}</div>
4747
<NotificationButtons />
4848
</div>
49-
<Notifications />
49+
<Notifications themeName={themeName} transitionName={transitionName} />
5050
{window.innerWidth > 767 ? (
5151
<div className={css.sidebar}>
5252
<NotificationCreator

demo/src/components/Notifications.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import {ThemeNames, THEMES, TransitionNames, TRANSITIONS} from '../constants'
22
import NotificationsSystem, {dismissNotification, Notification} from '../../../src'
3-
import React, {useState} from 'react'
3+
import React from 'react'
44
import {useDispatch, useSelector} from 'react-redux'
55

66
type RootState = {
77
notifications: Notification[]
88
}
99

10-
export const Notifications = () => {
10+
type Props = {
11+
themeName: ThemeNames
12+
transitionName: TransitionNames
13+
}
14+
15+
export const Notifications = ({themeName, transitionName}: Props) => {
1116
const dispatch = useDispatch()
12-
const [themeName] = useState<ThemeNames>('Atalho')
13-
const [transitionName] = useState<TransitionNames>('Slide')
1417
const notifications = useSelector((state: RootState) => state.notifications)
15-
const theme = THEMES[themeName]
1618

1719
return (
1820
<NotificationsSystem
@@ -21,7 +23,7 @@ export const Notifications = () => {
2123
}}
2224
notifications={notifications}
2325
dismissNotification={(id) => dispatch(dismissNotification(id))}
24-
theme={theme}
26+
theme={THEMES[themeName]}
2527
/>
2628
)
2729
}

0 commit comments

Comments
 (0)