Skip to content

Commit

Permalink
Add organization statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwon090 committed Apr 25, 2024
1 parent dab89d4 commit 1ed4ebc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions src/app/components/common/Statistics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use client'

import { Flex, StatGroup, Stat, StatLabel, StatNumber, StatHelpText, StatArrow } from '@chakra-ui/react'

export const Statistics = ({ text, value, unit, diff }: { text: string, value: number, unit?: string, diff?: number }) => {
return (
<Flex
borderWidth='1px'
borderRadius='lg'
padding={3}
flex={1}
>
<StatGroup>
<Stat>
<StatLabel>{ text }</StatLabel>
<StatNumber>{ value.toLocaleString() }{ unit ?? '' }</StatNumber>
{ diff &&
<StatHelpText mb={0}>
{ diff !== 0 &&
<StatArrow type={ (diff > 0) ? 'increase' : 'decrease' } />
}
{ diff.toLocaleString() }
</StatHelpText>
}

</Stat>
</StatGroup>
</Flex>
)
}
2 changes: 1 addition & 1 deletion src/app/components/layout/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const Navbar = () => {
</Flex>

<Stack
flex={{ base: 1, md: 0}}
flex={{ base: 1, md: 0 }}
justify='flex-end'
direction='row'
spacing={6}
Expand Down

0 comments on commit 1ed4ebc

Please sign in to comment.