From 3f812bd067fe0ad2aca9ee72963228ed52791b64 Mon Sep 17 00:00:00 2001 From: totop716 Date: Mon, 6 Dec 2021 11:20:08 +0800 Subject: [PATCH] update mobile view of landing/swap page and add function to invest button in reward slider of landing page --- src/components/Header/Header.tsx | 23 ++++++---- .../RewardSlider/RewardSliderItem.tsx | 13 +++++- src/components/TopMovers/TopMovers.tsx | 42 +++++++++++++------ src/pages/AnalyticsPage/AnalyticsPage.tsx | 3 +- src/pages/LandingPage/LandingPage.tsx | 22 +++++----- src/pages/SwapPage/SwapPage.tsx | 4 +- 6 files changed, 72 insertions(+), 35 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 8623a1309..48eca41aa 100755 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -21,11 +21,10 @@ import WalletIcon from 'assets/images/WalletIcon.png'; const useStyles = makeStyles(({ palette, breakpoints }) => ({ header: { - padding: '0 40px', + padding: '0 24px', position: 'relative', display: 'flex', flexWrap: 'wrap', - alignItems: 'center', minHeight: 88, zIndex: 3, justifyContent: 'space-between', @@ -58,6 +57,9 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({ }, }, }, + [breakpoints.down('sm')]: { + alignItems: 'center', + }, [breakpoints.down('xs')]: { padding: '0 16px', }, @@ -86,6 +88,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({ transform: 'translateX(-50%)', display: 'flex', alignItems: 'center', + height: '100%', '& .menuItem': { borderRadius: 10, cursor: 'pointer', @@ -149,7 +152,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({ }, }, mobileMenuWrapper: { - background: 'white', + background: '#121319', position: 'absolute', top: 80, left: 0, @@ -172,7 +175,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({ height: 32, width: '100%', '& p': { - color: palette.primary.dark, + color: '#ebecf2', }, '& svg, & img': { width: 32, @@ -321,7 +324,7 @@ const Header: React.FC = () => { pendingTransactions={pending} confirmedTransactions={confirmed} /> - + setMenuOpen(false)}> QuickLogo {!mobileWindowSize && ( @@ -416,9 +419,13 @@ const Header: React.FC = () => { )} > {menuItems.map((val, index) => ( - + setMenuOpen(false)} + > - {val.text} + {val.text} ))} @@ -428,7 +435,7 @@ const Header: React.FC = () => { onClick={toggleWalletModal} > Wallet - {shortenAddress(account)} + {shortenAddress(account)} ) : ( diff --git a/src/components/TopMovers/TopMovers.tsx b/src/components/TopMovers/TopMovers.tsx index d215441e5..a5d9eec32 100755 --- a/src/components/TopMovers/TopMovers.tsx +++ b/src/components/TopMovers/TopMovers.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useMemo } from 'react'; -import { Box, Typography } from '@material-ui/core'; +import { Box, Typography, useMediaQuery } from '@material-ui/core'; +import { makeStyles, useTheme } from '@material-ui/core/styles'; import { ArrowDropUp, ArrowDropDown } from '@material-ui/icons'; import Skeleton from '@material-ui/lab/Skeleton'; import { Token, ChainId } from '@uniswap/sdk'; @@ -7,6 +8,22 @@ import { CurrencyLogo } from 'components'; import { getEthPrice, getTopTokens } from 'utils'; import { useTopTokens } from 'state/application/hooks'; +const useStyles = makeStyles(({ breakpoints }) => ({ + content: { + width: '100%', + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', + [breakpoints.down('sm')]: { + flexWrap: 'wrap', + justifyContent: 'flex-start', + }, + [breakpoints.down('xs')]: { + flexDirection: 'column', + }, + }, +})); + interface TopMoversProps { background: string; hideArrow?: boolean; @@ -15,7 +32,10 @@ const TopMovers: React.FC = ({ background, hideArrow = false, }) => { + const classes = useStyles(); + const theme = useTheme(); const { topTokens, updateTopTokens } = useTopTokens(); + const smallWindowSize = useMediaQuery(theme.breakpoints.down('xs')); const topMoverTokens = useMemo( () => (topTokens && topTokens.length >= 5 ? topTokens.slice(0, 5) : null), @@ -39,9 +59,10 @@ const TopMovers: React.FC = ({ = ({ 24h TOP MOVERS - + {topMoverTokens ? ( - - {topMoverTokens.map((token: any) => { + + {topMoverTokens.map((token: any, index: number) => { const currency = new Token( ChainId.MATIC, token.id, @@ -72,10 +87,13 @@ const TopMovers: React.FC = ({ const priceUpPercent = Number(token.priceChangeUSD).toFixed(2); return ( diff --git a/src/pages/AnalyticsPage/AnalyticsPage.tsx b/src/pages/AnalyticsPage/AnalyticsPage.tsx index 9f22b67d1..c143b553a 100755 --- a/src/pages/AnalyticsPage/AnalyticsPage.tsx +++ b/src/pages/AnalyticsPage/AnalyticsPage.tsx @@ -11,12 +11,11 @@ import AnalyticsTokenDetails from './AnalyticTokenDetails'; const useStyles = makeStyles(({}) => ({ topTab: { - width: 120, height: 46, + padding: '0 24px', borderRadius: 10, display: 'flex', alignItems: 'center', - justifyContent: 'center', cursor: 'pointer', '& p': { color: '#626680', diff --git a/src/pages/LandingPage/LandingPage.tsx b/src/pages/LandingPage/LandingPage.tsx index 7d0796434..be7eda971 100755 --- a/src/pages/LandingPage/LandingPage.tsx +++ b/src/pages/LandingPage/LandingPage.tsx @@ -82,6 +82,10 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({ width: '100%', position: 'relative', zIndex: 2, + justifyContent: 'center', + [breakpoints.down('md')]: { + flexWrap: 'wrap', + }, '& > div': { background: palette.background.default, width: 'calc(25% - 24px)', @@ -201,6 +205,9 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({ swapInfo: { textAlign: 'left', marginBottom: 60, + [breakpoints.down('sm')]: { + order: -1, + }, '& h3': { marginBottom: 16, }, @@ -412,7 +419,6 @@ const LandingPage: React.FC = () => { const isnotMatic = ethereum && ethereum.isMetaMask && Number(ethereum.chainId) !== 137; const mobileWindowSize = useMediaQuery(theme.breakpoints.down('sm')); - const smallWindowSize = useMediaQuery(theme.breakpoints.down('xs')); const { initTransak } = useInitTransak(); const allTokens = useAllTokens(); const toggleWalletModal = useWalletModalToggle(); @@ -549,7 +555,7 @@ const LandingPage: React.FC = () => { }, [ethPrice, updateEthPrice, updateGlobalData]); return ( - + <> {openStakeModal && ( { - + {globalData ? ( @@ -714,7 +716,7 @@ const LandingPage: React.FC = () => { ))} - + @@ -849,15 +851,15 @@ const LandingPage: React.FC = () => { {socialicons.map((val, ind) => ( - {val.icon} + {val.icon} {val.title} ))} - + ); }; diff --git a/src/pages/SwapPage/SwapPage.tsx b/src/pages/SwapPage/SwapPage.tsx index 5735b3489..4d7951943 100755 --- a/src/pages/SwapPage/SwapPage.tsx +++ b/src/pages/SwapPage/SwapPage.tsx @@ -280,7 +280,7 @@ const SwapPage: React.FC = () => { - + @@ -338,7 +338,7 @@ const SwapPage: React.FC = () => { - + {currencies[Field.INPUT] && (