update pay function
This commit is contained in:
@@ -55,15 +55,25 @@ const parseMarkdownWithCharts = (markdown) => {
|
||||
/**
|
||||
* 支持 ECharts 图表的 Markdown 渲染组件
|
||||
* @param {string} content - Markdown 文本
|
||||
* @param {string} variant - 主题变体: 'light' | 'dark' | 'auto' (默认 auto,跟随系统)
|
||||
*/
|
||||
export const MarkdownWithCharts = ({ content }) => {
|
||||
export const MarkdownWithCharts = ({ content, variant = 'auto' }) => {
|
||||
const parts = parseMarkdownWithCharts(content);
|
||||
|
||||
// 深色/浅色模式颜色
|
||||
const textColor = useColorModeValue('gray.700', 'inherit');
|
||||
const headingColor = useColorModeValue('gray.800', 'inherit');
|
||||
const blockquoteColor = useColorModeValue('gray.600', 'gray.300');
|
||||
const codeBg = useColorModeValue('gray.100', 'rgba(255, 255, 255, 0.1)');
|
||||
// 系统颜色模式
|
||||
const systemTextColor = useColorModeValue('gray.700', 'gray.100');
|
||||
const systemHeadingColor = useColorModeValue('gray.800', 'gray.50');
|
||||
const systemBlockquoteColor = useColorModeValue('gray.600', 'gray.300');
|
||||
const systemCodeBg = useColorModeValue('gray.100', 'rgba(255, 255, 255, 0.1)');
|
||||
|
||||
// 根据 variant 选择颜色
|
||||
const isDark = variant === 'dark';
|
||||
const isLight = variant === 'light';
|
||||
|
||||
const textColor = isDark ? 'gray.100' : isLight ? 'gray.700' : systemTextColor;
|
||||
const headingColor = isDark ? 'gray.50' : isLight ? 'gray.800' : systemHeadingColor;
|
||||
const blockquoteColor = isDark ? 'gray.300' : isLight ? 'gray.600' : systemBlockquoteColor;
|
||||
const codeBg = isDark ? 'rgba(255, 255, 255, 0.1)' : isLight ? 'gray.100' : systemCodeBg;
|
||||
|
||||
return (
|
||||
<VStack align="stretch" spacing={4}>
|
||||
@@ -157,7 +167,7 @@ export const MarkdownWithCharts = ({ content }) => {
|
||||
|
||||
return (
|
||||
<Box key={index}>
|
||||
<EChartsRenderer option={chartOption} height={350} />
|
||||
<EChartsRenderer option={chartOption} height={350} variant={variant} />
|
||||
</Box>
|
||||
);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user