Skip to content
Draft
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
1 change: 0 additions & 1 deletion src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import SnackbarComponent from '../components/Global/SnackbarComponent/SnackbarCo

/** ***** Import JSX Files *******/
import PageHeader from './components/PageHeader/PageHeader';
// import SidebarFooter from '../components/Global/Sidebar/SidebarFooter/SidebarFooter';

/** * **** Import Local Files *******/
import './App.css';
Expand Down
9 changes: 7 additions & 2 deletions src/App/components/PageHeader/PageHeader.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@
max-height: 70%;
}



/* .announcement_bar {
display: flex;
flex-direction: row;
justify-content: space-between;
width: 100%;
background-color: yellow;
} */

@media (max-width: 800px) {
.primaryNavigation {
Expand Down
25 changes: 24 additions & 1 deletion src/App/components/PageHeader/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const PageHeader = function () {
const { headerImage } = useContext<BrandContextIF>(BrandContext);

const {
announcements,
walletModal: { open: openWalletModal },
appHeaderDropdown,
} = useContext(AppStateContext);
Expand Down Expand Up @@ -349,7 +350,6 @@ const PageHeader = function () {
<nav
className={styles.primaryNavigation}
id='primary_navigation'

>
{linkData.map((link, idx) =>
link.shouldDisplay ? (
Expand Down Expand Up @@ -407,6 +407,8 @@ const PageHeader = function () {
};
}, []);



return (
<>
<header
Expand Down Expand Up @@ -463,6 +465,27 @@ const PageHeader = function () {
)}
</div>
</header>
{ announcements.show &&
<div
// TODO: move styling to a css module once this component
// TODO: ... finds a permanent home in the hierarchy
// className={styles.announcement_bar}
style={{
width: '100%',
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
backgroundColor: 'yellow',
color: 'black',
position: 'sticky',
top: '55px',
zIndex: '99999',
}}
>
<p>Hi there!</p>
<div onClick={() => announcements.close()}>X</div>
</div>
}
{/* {isDevMenuEnabled && showDevMenu && <MobileDropdown />} */}
</>
);
Expand Down
20 changes: 20 additions & 0 deletions src/contexts/AppStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import { useTermsAgreed } from '../App/hooks/useTermsAgreed';
import { useWeb3Modal } from '@web3modal/ethers/react';

export interface AppStateContextIF {
announcements: {
show: boolean;
close: () => void;
},
appOverlay: { isActive: boolean; setIsActive: (val: boolean) => void };
appHeaderDropdown: {
isActive: boolean;
Expand Down Expand Up @@ -134,8 +138,23 @@ export const AppStateContextProvider = (props: {
const [_, hasAgreedTerms] = useTermsAgreed();
const { open: openW3Modal } = useWeb3Modal();

// logic and handling for the announcements bar, needs to be centralized
// ... as the component is instantiated multiple times
const SHOW_ANNOUNCEMENTS = true;
const [
showAnnouncements,
setShowAnnouncements
] = useState<boolean>(SHOW_ANNOUNCEMENTS);
function closeAnnouncements(): void {
setShowAnnouncements(false);
}

const appStateContext = useMemo(
() => ({
announcements: {
show: showAnnouncements,
close: closeAnnouncements,
},
appOverlay: {
isActive: isAppOverlayActive,
setIsActive: setIsAppOverlayActive,
Expand Down Expand Up @@ -176,6 +195,7 @@ export const AppStateContextProvider = (props: {
[
// Dependency list includes the memoized use*() values from above and any primitives
// directly references in above appState object
showAnnouncements,
snackbar,
globalPopup,
isChatOpen,
Expand Down