fix: prevent modal header jumping when toggling API key field
Reserve fixed height for API key input container and use visibility/opacity for show/hide instead of conditional rendering to maintain consistent modal height when selecting presets
This commit is contained in:
@@ -140,6 +140,18 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* API Key 输入框容器 - 预留空间避免抖动 */
|
||||||
|
.form-group.api-key-group {
|
||||||
|
min-height: 88px; /* 固定高度:label + input + 间距 */
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group.api-key-group.hidden {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.form-group input,
|
.form-group input,
|
||||||
.form-group textarea {
|
.form-group textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -255,19 +255,17 @@ const ProviderForm: React.FC<ProviderFormProps> = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showApiKey && (
|
<div className={`form-group api-key-group ${!showApiKey ? 'hidden' : ''}`}>
|
||||||
<div className="form-group">
|
<label htmlFor="apiKey">API Key *</label>
|
||||||
<label htmlFor="apiKey">API Key *</label>
|
<input
|
||||||
<input
|
type="text"
|
||||||
type="text"
|
id="apiKey"
|
||||||
id="apiKey"
|
value={apiKey}
|
||||||
value={apiKey}
|
onChange={(e) => handleApiKeyChange(e.target.value)}
|
||||||
onChange={(e) => handleApiKeyChange(e.target.value)}
|
placeholder="只需要填这里,下方配置会自动填充"
|
||||||
placeholder="只需要填这里,下方配置会自动填充"
|
autoComplete="off"
|
||||||
autoComplete="off"
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label htmlFor="websiteUrl">官网地址</label>
|
<label htmlFor="websiteUrl">官网地址</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user