-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove tremor for card-multi-metrics
- Loading branch information
Showing
11 changed files
with
108 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { cn } from '@/lib/utils' | ||
|
||
export interface CardMultiMetricsProps { | ||
primary?: string | number | React.ReactNode | ||
items?: { | ||
current: number | ||
target: number | ||
currentReadable?: string | ||
targetReadable?: string | ||
}[] | ||
currentLabel?: string | ||
targetLabel?: string | ||
className?: string | ||
} | ||
|
||
export function CardMultiMetrics({ | ||
primary, | ||
items = [], | ||
currentLabel = 'Current', | ||
targetLabel = 'Total', | ||
className, | ||
}: CardMultiMetricsProps) { | ||
return ( | ||
<div className={cn('flex flex-col gap-4', className)}> | ||
<div className="text-xl md:text-3xl">{primary}</div> | ||
|
||
<div className="flex flex-col justify-between text-sm"> | ||
<div className="mt-2 flex flex-row justify-between font-bold"> | ||
<span className="truncate">{currentLabel}</span> | ||
<span className="truncate">{targetLabel}</span> | ||
</div> | ||
|
||
{items.map((item, i) => { | ||
const _percent = (item.current / item.target) * 100 | ||
|
||
return ( | ||
<div key={i}> | ||
<div className="mt-2 flex flex-row items-center justify-between gap-2"> | ||
<span className="truncate text-muted-foreground"> | ||
{item.currentReadable} | ||
</span> | ||
<hr className="shrink grow border-dotted" /> | ||
<span className="text-nowrap">{item.targetReadable}</span> | ||
</div> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
</div> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters