@chakra-ui/react#StatGroup JavaScript Examples

The following examples show how to use @chakra-ui/react#StatGroup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatBox.js    From benjamincarlson.io with MIT License 6 votes vote down vote up
export default function StatBox({ title, desc, url }) {
    const { colorMode } = useColorMode()
    const borderColor = {
        light: '#CBD5E0',
        dark: '#4A5568',
    }
    const [opacity, setOpacity] = useState(0)
    
    return (
        <Link
            href={url}
            isExternal
            _hover={{
                textDecoration: 'none'
            }}
            onMouseOver={() => setOpacity(1)}
            onMouseLeave={() => setOpacity(0)}
        >
            <Box p={2} pb={[2, 1, 1]}>
                <StatGroup border={`1px solid ${borderColor[colorMode]}`} borderRadius={5} p={2} w="100%">
                    <Stat>
                        <Flex
                            align="center"
                            justifyContent="space-between"
                        >
                            <StatLabel>{desc}</StatLabel>
                            <ExternalLinkIcon opacity={opacity} />
                        </Flex>
                        <StatNumber>{title}</StatNumber>
                    </Stat>
                </StatGroup>
            </Box>
        </Link>
    )
}
Example #2
Source File: UsagePage.js    From web-client with Apache License 2.0 6 votes vote down vote up
SystemUsagePage = () => {
    const [usage] = useFetch('/system/usage');

    if (!usage) return <Loading />

    return <div>
        <div className='heading'>
            <Breadcrumb />
        </div>
        <Title type="System" title="Usage" icon={<IconDownloadDocument />} />

        <StatGroup>
            <Stat>
                <StatLabel>Attachments count</StatLabel>
                <StatNumber>{usage.attachments.total_count} total</StatNumber>
            </Stat>

            <Stat>
                <StatLabel>Attachments total disk usage</StatLabel>
                <StatNumber><FileSizeSpan fileSize={usage.attachments.total_file_size} /></StatNumber>
            </Stat>
        </StatGroup>
    </div>
}