Commit b0bdafe7 authored by tom's avatar tom Committed by isstuev

mobile view

parent ca985c24
...@@ -25,7 +25,7 @@ const ChainIndicatorChartContainer = ({ data, isError, isLoading }: Props) => { ...@@ -25,7 +25,7 @@ const ChainIndicatorChartContainer = ({ data, isError, isLoading }: Props) => {
return <ChainIndicatorChart data={ data }/>; return <ChainIndicatorChart data={ data }/>;
})(); })();
return <Flex h={{ base: '130px', lg: '270px' }} alignItems="flex-start">{ content }</Flex>; return <Flex h={{ base: '150px', lg: '270px' }} alignItems="flex-start">{ content }</Flex>;
}; };
export default React.memo(ChainIndicatorChartContainer); export default React.memo(ChainIndicatorChartContainer);
...@@ -5,6 +5,8 @@ import React from 'react'; ...@@ -5,6 +5,8 @@ import React from 'react';
import type { ChainIndicatorId } from './types'; import type { ChainIndicatorId } from './types';
import type { Stats } from 'types/api/stats'; import type { Stats } from 'types/api/stats';
import useIsMobile from 'lib/hooks/useIsMobile';
interface Props { interface Props {
id: ChainIndicatorId; id: ChainIndicatorId;
title: string; title: string;
...@@ -17,12 +19,17 @@ interface Props { ...@@ -17,12 +19,17 @@ interface Props {
const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats }: Props) => { const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats }: Props) => {
const bgColor = useColorModeValue('white', 'gray.900'); const bgColor = useColorModeValue('white', 'gray.900');
const isMobile = useIsMobile();
const handleClick = React.useCallback(() => { const handleClick = React.useCallback(() => {
onClick(id); onClick(id);
}, [ id, onClick ]); }, [ id, onClick ]);
const valueContent = (() => { const valueContent = (() => {
if (isMobile) {
return null;
}
if (stats.isLoading) { if (stats.isLoading) {
return <Skeleton h={ 3 } w="70px" my={ 1.5 }/>; return <Skeleton h={ 3 } w="70px" my={ 1.5 }/>;
} }
......
...@@ -65,17 +65,17 @@ const ChainIndicators = () => { ...@@ -65,17 +65,17 @@ const ChainIndicators = () => {
return ( return (
<Flex <Flex
p={ 8 } p={{ base: 0, lg: 8 }}
borderRadius="lg" borderRadius={{ base: 'none', lg: 'lg' }}
boxShadow="xl" boxShadow={{ base: 'none', lg: 'xl' }}
bgColor={ bgColor } bgColor={ bgColor }
columnGap={ 12 } columnGap={ 12 }
rowGap={ 12 } rowGap={ 0 }
flexDir={{ base: 'column', lg: 'row' }} flexDir={{ base: 'column', lg: 'row' }}
w="100%" w="100%"
alignItems="stretch" alignItems="stretch"
> >
<Flex flexGrow={ 1 } flexDir="column"> <Flex flexGrow={ 1 } flexDir="column" order={{ base: 2, lg: 1 }} p={{ base: 6, lg: 0 }}>
<Flex alignItems="center"> <Flex alignItems="center">
<Text fontWeight={ 500 } fontFamily="heading" fontSize="lg">{ indicator?.title }</Text> <Text fontWeight={ 500 } fontFamily="heading" fontSize="lg">{ indicator?.title }</Text>
{ indicator?.hint && ( { indicator?.hint && (
...@@ -90,7 +90,7 @@ const ChainIndicators = () => { ...@@ -90,7 +90,7 @@ const ChainIndicators = () => {
<ChainIndicatorChartContainer { ...queryResult }/> <ChainIndicatorChartContainer { ...queryResult }/>
</Flex> </Flex>
{ indicators.length > 1 && ( { indicators.length > 1 && (
<Flex flexShrink={ 0 } flexDir="column" as="ul" p={ 3 } borderRadius="lg" bgColor={ listBgColor } rowGap={ 3 }> <Flex flexShrink={ 0 } flexDir="column" as="ul" p={ 3 } borderRadius="lg" bgColor={ listBgColor } rowGap={ 3 } order={{ base: 1, lg: 2 }}>
{ indicators.map((indicator) => ( { indicators.map((indicator) => (
<ChainIndicatorItem <ChainIndicatorItem
key={ indicator.id } key={ indicator.id }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment