Commit 6a3cdc58 authored by Joel's avatar Joel

enchance cost token style

parent 71871f73
...@@ -2,9 +2,9 @@ import React from 'react' ...@@ -2,9 +2,9 @@ import React from 'react'
import { import {
InformationCircleIcon, InformationCircleIcon,
} from '@heroicons/react/24/outline' } from '@heroicons/react/24/outline'
import cn from 'classnames'
import Tooltip from '../base/tooltip' import Tooltip from '../base/tooltip'
import AppIcon from '../base/app-icon' import AppIcon from '../base/app-icon'
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_' const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_'
export function randomString(length: number) { export function randomString(length: number) {
...@@ -21,6 +21,7 @@ export type IAppBasicProps = { ...@@ -21,6 +21,7 @@ export type IAppBasicProps = {
type: string | React.ReactNode type: string | React.ReactNode
hoverTip?: string hoverTip?: string
textStyle?: { main?: string; extra?: string } textStyle?: { main?: string; extra?: string }
isExtraInLine?: boolean
} }
const ApiSvg = <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> const ApiSvg = <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
...@@ -61,7 +62,7 @@ const ICON_MAP = { ...@@ -61,7 +62,7 @@ const ICON_MAP = {
notion: <AppIcon innerIcon={NotionSvg} className='!border-[0.5px] !border-indigo-100 !bg-white' />, notion: <AppIcon innerIcon={NotionSvg} className='!border-[0.5px] !border-indigo-100 !bg-white' />,
} }
export default function AppBasic({ icon, icon_background, name, type, hoverTip, textStyle, iconType = 'app' }: IAppBasicProps) { export default function AppBasic({ icon, icon_background, name, type, hoverTip, textStyle, iconType = 'app', isExtraInLine }: IAppBasicProps) {
return ( return (
<div className="flex items-start"> <div className="flex items-start">
{icon && icon_background && iconType === 'app' && ( {icon && icon_background && iconType === 'app' && (
...@@ -75,7 +76,7 @@ export default function AppBasic({ icon, icon_background, name, type, hoverTip, ...@@ -75,7 +76,7 @@ export default function AppBasic({ icon, icon_background, name, type, hoverTip,
</div> </div>
} }
<div className="group"> <div className={cn('group', isExtraInLine && 'flex items-end space-x-2')}>
<div className={`flex flex-row items-center text-sm font-semibold text-gray-700 group-hover:text-gray-900 ${textStyle?.main}`}> <div className={`flex flex-row items-center text-sm font-semibold text-gray-700 group-hover:text-gray-900 ${textStyle?.main}`}>
{name} {name}
{hoverTip {hoverTip
......
...@@ -231,6 +231,7 @@ const Chart: React.FC<IChartProps> = ({ ...@@ -231,6 +231,7 @@ const Chart: React.FC<IChartProps> = ({
</div> </div>
<div className='mb-4'> <div className='mb-4'>
<Basic <Basic
isExtraInLine={CHART_TYPE_CONFIG[chartType].showTokens}
name={chartType !== 'costs' ? (sumData.toLocaleString() + unit) : `${sumData < 1000 ? sumData : (`${formatNumber(Math.round(sumData / 1000))}k`)}`} name={chartType !== 'costs' ? (sumData.toLocaleString() + unit) : `${sumData < 1000 ? sumData : (`${formatNumber(Math.round(sumData / 1000))}k`)}`}
type={!CHART_TYPE_CONFIG[chartType].showTokens type={!CHART_TYPE_CONFIG[chartType].showTokens
? '' ? ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment