Skip to content

Commit

Permalink
chore: fix demo (theme and transition selector) (#564)
Browse files Browse the repository at this point in the history
closes #562
  • Loading branch information
LouisBarranqueiro committed Mar 11, 2024
1 parent 9044d21 commit 3a3b68a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion demo/src/components/Demo/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Demo = () => {
<div className={css.description}>{packageJson.description}</div>
<NotificationButtons />
</div>
<Notifications />
<Notifications themeName={themeName} transitionName={transitionName} />
{window.innerWidth > 767 ? (
<div className={css.sidebar}>
<NotificationCreator
Expand Down
14 changes: 8 additions & 6 deletions demo/src/components/Notifications.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import {ThemeNames, THEMES, TransitionNames, TRANSITIONS} from '../constants'
import NotificationsSystem, {dismissNotification, Notification} from '../../../src'
import React, {useState} from 'react'
import React from 'react'
import {useDispatch, useSelector} from 'react-redux'

type RootState = {
notifications: Notification[]
}

export const Notifications = () => {
type Props = {
themeName: ThemeNames
transitionName: TransitionNames
}

export const Notifications = ({themeName, transitionName}: Props) => {
const dispatch = useDispatch()
const [themeName] = useState<ThemeNames>('Atalho')
const [transitionName] = useState<TransitionNames>('Slide')
const notifications = useSelector((state: RootState) => state.notifications)
const theme = THEMES[themeName]

return (
<NotificationsSystem
Expand All @@ -21,7 +23,7 @@ export const Notifications = () => {
}}
notifications={notifications}
dismissNotification={(id) => dispatch(dismissNotification(id))}
theme={theme}
theme={THEMES[themeName]}
/>
)
}
Expand Down

0 comments on commit 3a3b68a

Please sign in to comment.