Skip to content

Commit

Permalink
Merge pull request #14321 from bhushanpardeshii/migrate_stat
Browse files Browse the repository at this point in the history
Migrated stat component to shadcn/tailwind
  • Loading branch information
pettinarip authored Dec 24, 2024
2 parents 0990e83 + a64a41c commit d042f4a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/components/Stat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
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 { Flex } from "@/components/ui/flex"

import { NULL_VALUE } from "@/lib/constants"

Expand Down Expand Up @@ -39,22 +40,20 @@ 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>
)
}

export default Stat
export default Stat

0 comments on commit d042f4a

Please sign in to comment.