Extract add config button and wrap selector with Flex
This commit is contained in:
parent
f90923736f
commit
9a7e6a8934
@ -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}
|
||||
|
||||
@ -105,7 +105,6 @@ export function MainPage({ initialConfigs }: MainPageProps) {
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<CloudUploadOutlined />}
|
||||
size="large"
|
||||
onClick={() => setPublishOpen(true)}
|
||||
disabled={!selectedConfig}
|
||||
>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user