Extract add config button and wrap selector with Flex

This commit is contained in:
CPTProgrammer 2026-07-16 13:02:51 +08:00
parent f90923736f
commit 9a7e6a8934
No known key found for this signature in database
2 changed files with 20 additions and 19 deletions

View File

@ -1,7 +1,7 @@
"use client";
import { useState, useCallback } from "react";
import { Select, Button, Space, App } from "antd";
import { Select, Button, Space, Flex, App } from "antd";
import { EditOutlined, PlusOutlined } from "@ant-design/icons";
import { ConfigModal } from "./ConfigModal";
import { getConfig } from "@/services/config";
@ -97,25 +97,27 @@ export function ConfigSelector({
return (
<>
<Space.Compact style={{ width: "100%" }}>
<Select
style={{ flex: 1 }}
placeholder="选择配置…"
loading={selecting}
value={selectedFile}
onChange={handleChange}
options={configs.map((c) => ({
value: c.file,
label: c.name,
}))}
/>
<Button icon={<EditOutlined />} onClick={openEdit}>
</Button>
<Button icon={<PlusOutlined />} onClick={openAdd}>
<Flex gap="small" style={{ width: "100%" }}>
<Space.Compact style={{ flex: 1 }}>
<Select
style={{ flex: 1 }}
placeholder="选择配置…"
loading={selecting}
value={selectedFile}
onChange={handleChange}
options={configs.map((c) => ({
value: c.file,
label: c.name,
}))}
/>
<Button icon={<EditOutlined />} onClick={openEdit}>
</Button>
</Space.Compact>
<Button type="primary" icon={<PlusOutlined />} onClick={openAdd}>
</Button>
</Space.Compact>
</Flex>
<ConfigModal
open={modalOpen}

View File

@ -105,7 +105,6 @@ export function MainPage({ initialConfigs }: MainPageProps) {
<Button
type="primary"
icon={<CloudUploadOutlined />}
size="large"
onClick={() => setPublishOpen(true)}
disabled={!selectedConfig}
>