Skip to content

Commit

Permalink
Merge pull request #4810 from h3poteto/fix/toast
Browse files Browse the repository at this point in the history
Show toast
  • Loading branch information
h3poteto authored Jan 28, 2024
2 parents ca21bac + 613ff62 commit 2c64c19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions renderer/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AccountLayout from '@/components/layouts/account'
import TimelineLayout from '@/components/layouts/timelines'
import { IntlProviderWrapper } from '@/utils/i18n'
import { ThemeProvider } from '@material-tailwind/react'
import { ToastProvider } from '@/utils/toast'

export default function MyApp({ Component, pageProps }: AppProps) {
const customTheme = {
Expand Down Expand Up @@ -102,11 +103,13 @@ export default function MyApp({ Component, pageProps }: AppProps) {
return (
<ThemeProvider value={customTheme}>
<IntlProviderWrapper>
<AccountLayout>
<TimelineLayout>
<Component {...pageProps} />
</TimelineLayout>
</AccountLayout>
<ToastProvider>
<AccountLayout>
<TimelineLayout>
<Component {...pageProps} />
</TimelineLayout>
</AccountLayout>
</ToastProvider>
</IntlProviderWrapper>
</ThemeProvider>
)
Expand Down
2 changes: 1 addition & 1 deletion renderer/utils/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ export const ToastProvider: React.FC<Props> = ({ children }) => {

return (
<ToastContext.Provider value={showToast}>
{children}
<div className={`${showable ? 'block' : 'hidden'} fixed top-2 -translate-x-1/2`} style={{ left: '50%' }}>
<Alert color={color(toastType)} className="w96">
<span>{toastText}</span>
</Alert>
</div>
{children}
</ToastContext.Provider>
)
}

0 comments on commit 2c64c19

Please sign in to comment.