continue updating code card

This commit is contained in:
Nate Kelley 2025-02-26 17:59:50 -07:00
parent 94d4d447a9
commit 628051ed43
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
4 changed files with 28 additions and 34 deletions

View File

@ -5,6 +5,7 @@ import { cn } from '@/lib/utils';
const sizeVariants = cva('', { const sizeVariants = cva('', {
variants: { variants: {
size: { size: {
xsmall: 'h-[32px] min-h-[32px] px-2.5',
small: 'p-2.5', small: 'p-2.5',
default: 'p-4' default: 'p-4'
} }

View File

@ -1,11 +1,12 @@
import { createStyles } from 'antd-style'; import { createStyles } from 'antd-style';
import React from 'react'; import React from 'react';
import { Text } from '@/components/ui';
import { AppCodeEditor } from '../inputs/AppCodeEditor'; import { AppCodeEditor } from '../inputs/AppCodeEditor';
import { Button } from 'antd';
import { AppMaterialIcons } from '../icons';
import { useMemoizedFn } from 'ahooks'; import { useMemoizedFn } from 'ahooks';
import { useBusterNotifications } from '@/context/BusterNotifications'; import { useBusterNotifications } from '@/context/BusterNotifications';
import { cn } from '@/lib/classMerge';
import { Button } from '../buttons/Button';
import { Card, CardHeader, CardContent, CardDescription, CardFooter, CardTitle } from './CardBase';
import { Download, Copy } from '../icons';
export const CodeCard: React.FC<{ export const CodeCard: React.FC<{
code: string; code: string;
@ -33,16 +34,14 @@ export const CodeCard: React.FC<{
const ShownButtons = buttons === true ? <CardButtons fileName={fileName} code={code} /> : buttons; const ShownButtons = buttons === true ? <CardButtons fileName={fileName} code={code} /> : buttons;
return ( return (
<div className={cx(styles.container, className)}> <Card className={cn('h-full', className)}>
<div <CardHeader variant={'gray'} size={'xsmall'} className="justify-center">
className={cx( <div className="flex items-center justify-between gap-x-1">
styles.containerHeader, <span className="truncate text-base">{fileName}</span>
'flex items-center justify-between space-x-1 px-2.5'
)}>
<Text className="truncate">{fileName}</Text>
{ShownButtons} {ShownButtons}
</div> </div>
</CardHeader>
<CardContent className={cn('bg-background overflow-hidden p-0', bodyClassName)}>
<div className={cx(styles.containerBody, bodyClassName)}> <div className={cx(styles.containerBody, bodyClassName)}>
<AppCodeEditor <AppCodeEditor
language={language} language={language}
@ -53,7 +52,8 @@ export const CodeCard: React.FC<{
onMetaEnter={onMetaEnter} onMetaEnter={onMetaEnter}
/> />
</div> </div>
</div> </CardContent>
</Card>
); );
}; };
@ -90,15 +90,10 @@ const CardButtons: React.FC<{
return ( return (
<div className="flex items-center gap-1"> <div className="flex items-center gap-1">
<Button variant="ghost" prefix={<Copy />} onClick={handleCopyCode} title="Copy code" />
<Button <Button
type="text" variant="ghost"
icon={<AppMaterialIcons icon="content_copy" />} prefix={<Download />}
onClick={handleCopyCode}
title="Copy code"
/>
<Button
type="text"
icon={<AppMaterialIcons icon="download" />}
onClick={handleDownload} onClick={handleDownload}
title="Download file" title="Download file"
/> />

View File

@ -102,7 +102,6 @@ const _DashboardMetricItem: React.FC<{
data={data} data={data}
loading={loading} loading={loading}
error={error} error={error}
bordered={false}
onInitialAnimationEnd={onInitialAnimationEndPreflight} onInitialAnimationEnd={onInitialAnimationEndPreflight}
animate={!isDragOverlay && animate} animate={!isDragOverlay && animate}
animateLegend={false} animateLegend={false}

View File

@ -32,7 +32,6 @@ export const generateChartDownloadImage = async (
<div className={`h-[655px] w-[880px]`}> <div className={`h-[655px] w-[880px]`}>
<div className="relative flex h-full w-full items-center justify-center p-0"> <div className="relative flex h-full w-full items-center justify-center p-0">
<BusterChart <BusterChart
bordered={false}
data={messageData} data={messageData}
animate={false} animate={false}
onChartMounted={async (chart) => { onChartMounted={async (chart) => {