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:
parent
7e9957806e
commit
2c4b1be806
|
|
@ -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 }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue