Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix demo (theme and transition selector) #564

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading