fix: title auto-visible when text entered + add show/hide switch

Typing title text now auto-sets visible=true so the title appears
immediately. Also added a Switch to toggle title visibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hailin 2026-04-05 03:03:32 -07:00
parent 7e9957806e
commit 2c4b1be806
1 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
'use client';
import React, { useCallback } from 'react';
import { Input, InputNumber, Select, ColorPicker, Space, Typography } from 'antd';
import { Input, InputNumber, Select, ColorPicker, Switch, Space, Typography } from 'antd';
import { useChartConfig } from '@/frameworks/hooks/useChartConfig';
import type { TitleStyle } from '@/domain/entities/StyleConfig';
@ -23,11 +23,19 @@ export default function TitleConfig() {
return (
<Space direction="vertical" style={{ width: '100%' }} size={12}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Text style={{ fontSize: 12 }}></Text>
<Switch
size="small"
checked={title.visible}
onChange={(checked) => update({ visible: checked })}
/>
</div>
<div>
<Text style={{ fontSize: 12 }}></Text>
<Input
value={title.text}
onChange={(e) => update({ text: e.target.value })}
onChange={(e) => update({ text: e.target.value, visible: true })}
placeholder="请输入标题"
size="small"
style={{ marginTop: 4 }}