From 7cb92028fb54822384b26669e02c8b5e290c6a2e Mon Sep 17 00:00:00 2001 From: Alex Zoitos Date: Thu, 8 Oct 2020 06:12:18 -0400 Subject: [PATCH] Redesign toasts (#103) * feat(frontend): custom toast * refactor(frontend): move toast width styling to globals Co-authored-by: sct --- src/components/Toast/index.tsx | 106 +++++++++++++++++++++++++++++++++ src/pages/_app.tsx | 3 +- src/styles/globals.css | 8 ++- 3 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 src/components/Toast/index.tsx diff --git a/src/components/Toast/index.tsx b/src/components/Toast/index.tsx new file mode 100644 index 000000000..2fb7e6c31 --- /dev/null +++ b/src/components/Toast/index.tsx @@ -0,0 +1,106 @@ +import React from 'react'; +import type { ToastProps } from 'react-toast-notifications'; + +const Toast: React.FC = ({ appearance, children, onDismiss }) => { + return ( +
+
+
+
+
+
+ {appearance === 'success' && ( + + + + )} + + {appearance === 'error' && ( + + + + )} + + {appearance === 'info' && ( + + + + )} + + {appearance === 'warning' && ( + + + + )} +
+
{children}
+
+ +
+
+
+
+
+
+ ); +}; + +export default Toast; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 85ab090d0..81f2fa9d2 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -11,6 +11,7 @@ import { User } from '../hooks/useUser'; import { IntlProvider } from 'react-intl'; import { LanguageContext, AvailableLocales } from '../context/LanguageContext'; import Head from 'next/head'; +import Toast from '../components/Toast'; const loadLocaleData = (locale: string) => { switch (locale) { @@ -76,7 +77,7 @@ const CoreApp: Omit = ({ defaultLocale="en" messages={loadedMessages} > - + Overseerr diff --git a/src/styles/globals.css b/src/styles/globals.css index 49a66be9a..e93708f7c 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -21,10 +21,14 @@ body { } .hide-scrollbar { - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ } .hide-scrollbar::-webkit-scrollbar { display: none; } + +.toast { + width: 360px; +}