Skip to content

Commit

Permalink
migration stat component to shadcn/tailwind [Fixes ethereum#13946]
Browse files Browse the repository at this point in the history
  • Loading branch information
bhushanpardeshii committed Nov 6, 2024
1 parent cd1e25f commit cf72be4
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/components/Stat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { useEffect, useState } from "react"
import type { IconType } from "react-icons/lib"
import { MdInfoOutline, MdWarning } from "react-icons/md"
import { chakra, Flex, HStack, Icon, Text } from "@chakra-ui/react"

import type { IconType } from "react-icons/lib"
import { NULL_VALUE } from "@/lib/constants"

import { Flex } from "@/components/ui/flex"
import Tooltip, { type TooltipProps } from "../Tooltip"


const initialContent = {
contentValue: NULL_VALUE,
tooltipIcon: MdInfoOutline,
Expand Down Expand Up @@ -39,20 +38,18 @@ const Stat = ({ tooltipProps, value, label, isError }: StatProps) => {
}, [isError, value])

return (
<Flex flexDirection="column-reverse">
<HStack lineHeight="initial" spacing="0.5" color="body.medium">
<Text as="span">{label}</Text>
<Flex className="flex-col-reverse">
<div className="flex items-center space-x-2 leading-none text-body-medium">
<span>{label}</span>
{!!tooltipProps && (
<Tooltip {...tooltipProps}>
<chakra.button display="flex" color="inherit">
<Icon as={content.tooltipIcon} />
</chakra.button>
<button className="flex text-inherit">
<content.tooltipIcon className="h-4 w-4" />
</button>
</Tooltip>
)}
</HStack>
<Text as="span" size="5xl" fontWeight="bold">
{content.contentValue}
</Text>
</div>
<span className="text-5xl font-bold">{content.contentValue}</span>
</Flex>
)
}
Expand Down

0 comments on commit cf72be4

Please sign in to comment.