Commit db5f2ae7 authored by isstuev's avatar isstuev

custom media 4 homepage stats

parent fea7d736
import { Flex, Icon, Text, useColorModeValue, chakra } from '@chakra-ui/react'; import { Flex, Icon, Text, useColorModeValue, chakra } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import breakpoints from 'theme/foundations/breakpoints';
type Props = { type Props = {
icon: React.FC<React.SVGAttributes<SVGElement>>; icon: React.FC<React.SVGAttributes<SVGElement>>;
title: string; title: string;
...@@ -8,13 +10,24 @@ type Props = { ...@@ -8,13 +10,24 @@ type Props = {
className?: string; className?: string;
} }
const LARGEST_BREAKPOINT = '1240px';
const StatsItem = ({ icon, title, value, className }: Props) => { const StatsItem = ({ icon, title, value, className }: Props) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const sxContainer = {} as any;
sxContainer[`@media screen and (min-width: ${ breakpoints.lg }) and (max-width: ${ LARGEST_BREAKPOINT })`] = { flexDirection: 'column' };
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const sxText = {} as any;
sxText[`@media screen and (min-width: ${ breakpoints.lg }) and (max-width: ${ LARGEST_BREAKPOINT })`] = { alignItems: 'center' };
return ( return (
<Flex <Flex
backgroundColor={ useColorModeValue('blue.50', 'blue.800') } backgroundColor={ useColorModeValue('blue.50', 'blue.800') }
padding={ 3 } padding={ 3 }
borderRadius="md" borderRadius="md"
flexDirection={{ base: 'row', lg: 'column', xl: 'row' }} flexDirection="row"
sx={ sxContainer }
alignItems="center" alignItems="center"
columnGap={ 3 } columnGap={ 3 }
rowGap={ 2 } rowGap={ 2 }
...@@ -22,7 +35,11 @@ const StatsItem = ({ icon, title, value, className }: Props) => { ...@@ -22,7 +35,11 @@ const StatsItem = ({ icon, title, value, className }: Props) => {
color={ useColorModeValue('black', 'white') } color={ useColorModeValue('black', 'white') }
> >
<Icon as={ icon } boxSize={ 7 }/> <Icon as={ icon } boxSize={ 7 }/>
<Flex flexDirection="column" alignItems={{ base: 'start', lg: 'center', xl: 'start' }}> <Flex
flexDirection="column"
alignItems="start"
sx={ sxText }
>
<Text variant="secondary" fontSize="xs" lineHeight="16px">{ title }</Text> <Text variant="secondary" fontSize="xs" lineHeight="16px">{ title }</Text>
<Text fontWeight={ 500 } fontSize="md" color={ useColorModeValue('black', 'white') }>{ value }</Text> <Text fontWeight={ 500 } fontSize="md" color={ useColorModeValue('black', 'white') }>{ value }</Text>
</Flex> </Flex>
......
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