forked from blockscout/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request blockscout#1822 from blockscout/rework-marketplace…
…-app-header Rework marketplace app header and tooltips
- Loading branch information
Showing
22 changed files
with
283 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useRouter } from 'next/router'; | ||
import React, { createContext, useContext, useEffect, useState, useMemo } from 'react'; | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
} | ||
|
||
type TMarketplaceContext = { | ||
isAutoConnectDisabled: boolean; | ||
setIsAutoConnectDisabled: (isAutoConnectDisabled: boolean) => void; | ||
} | ||
|
||
const MarketplaceContext = createContext<TMarketplaceContext>({ | ||
isAutoConnectDisabled: false, | ||
setIsAutoConnectDisabled: () => {}, | ||
}); | ||
|
||
export function MarketplaceContextProvider({ children }: Props) { | ||
const router = useRouter(); | ||
const [ isAutoConnectDisabled, setIsAutoConnectDisabled ] = useState(false); | ||
|
||
useEffect(() => { | ||
const handleRouteChange = () => { | ||
setIsAutoConnectDisabled(false); | ||
}; | ||
|
||
router.events.on('routeChangeStart', handleRouteChange); | ||
|
||
return () => { | ||
router.events.off('routeChangeStart', handleRouteChange); | ||
}; | ||
}, [ router.events ]); | ||
|
||
const value = useMemo(() => ({ | ||
isAutoConnectDisabled, | ||
setIsAutoConnectDisabled, | ||
}), [ isAutoConnectDisabled, setIsAutoConnectDisabled ]); | ||
|
||
return ( | ||
<MarketplaceContext.Provider value={ value }> | ||
{ children } | ||
</MarketplaceContext.Provider> | ||
); | ||
} | ||
|
||
export function useMarketplaceContext() { | ||
return useContext(MarketplaceContext); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+258 Bytes
(100%)
...__screenshots__/MarketplaceApp.pw.tsx_dark-color-mode_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+211 Bytes
(100%)
ui/pages/__screenshots__/MarketplaceApp.pw.tsx_default_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.5 KB
(73%)
ui/pages/__screenshots__/MarketplaceApp.pw.tsx_default_mobile-base-view-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import { Flex } from '@chakra-ui/react'; | ||
import { Flex, chakra } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
interface Props { | ||
children: React.ReactNode; | ||
className?: string; | ||
} | ||
|
||
const MainArea = ({ children }: Props) => { | ||
const MainArea = ({ children, className }: Props) => { | ||
return ( | ||
<Flex w="100%" minH="calc(100vh - 36px)" alignItems="stretch"> | ||
<Flex className={ className } w="100%" minH="calc(100vh - 36px)" alignItems="stretch"> | ||
{ children } | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default React.memo(MainArea); | ||
export default React.memo(chakra(MainArea)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.