From 3eda37f0dea7c7df260078774b59b04c0b890787 Mon Sep 17 00:00:00 2001 From: tuliomir Date: Mon, 16 Dec 2024 21:01:51 -0300 Subject: [PATCH] fix: error handling on nav search --- src/components/Navigation.js | 333 ++++++++++++++++--------------- src/components/NewHathorAlert.js | 6 +- src/newUi.scss | 6 + 3 files changed, 182 insertions(+), 163 deletions(-) diff --git a/src/components/Navigation.js b/src/components/Navigation.js index 25058151..571de402 100644 --- a/src/components/Navigation.js +++ b/src/components/Navigation.js @@ -29,6 +29,7 @@ import { REACT_APP_NETWORK, } from '../constants'; import { toggleTheme } from '../actions'; +import NewHathorAlert from './NewHathorAlert'; function Navigation() { const history = useHistory(); @@ -86,56 +87,109 @@ function Navigation() { const hathorNetwork = `Hathor ${REACT_APP_NETWORK}`; return ( - + + setShowSidebar(false)} open={showSidebar} /> + + + ); }; diff --git a/src/components/NewHathorAlert.js b/src/components/NewHathorAlert.js index 4761f5a5..a22d2276 100644 --- a/src/components/NewHathorAlert.js +++ b/src/components/NewHathorAlert.js @@ -15,6 +15,7 @@ import { ReactComponent as SuccessIcon } from '../assets/images/success-icon.svg * @param {Object} props - Component properties. * @param {string} props.type - Defines the alert type for styling (e.g., "success", "error"). * @param {string} props.text - The message text displayed in the alert. + * @param {boolean} [props.fixedPosition=false] - If true, the alert will be fixed at the bottom right of the screen * @param {React.Ref} ref - A reference to call the `show` method from parent components. * * @example: @@ -24,7 +25,7 @@ import { ReactComponent as SuccessIcon } from '../assets/images/success-icon.svg * alertRef.current.show(2000); // Show the alert for 2 seconds * ``` */ -const NewHathorAlert = forwardRef(({ type, text, showAlert }, ref) => { +const NewHathorAlert = forwardRef(({ type, text, showAlert, fixedPosition }, ref) => { const alertDiv = useRef(null); /** @@ -56,10 +57,11 @@ const NewHathorAlert = forwardRef(({ type, text, showAlert }, ref) => { show, })); + const fixedPositionClass = fixedPosition ? 'fixed-position' : ''; return (
diff --git a/src/newUi.scss b/src/newUi.scss index 38bdacad..f9814539 100644 --- a/src/newUi.scss +++ b/src/newUi.scss @@ -932,6 +932,12 @@ nav { justify-content: space-between; z-index: 9999; margin: 0; + + &.fixed-position { + position: fixed !important; + right: 2rem; + bottom: 2rem; + } } .alert-success-container {