复用项目页重命名弹窗组件
项目页重命名改用 UnifiedModal 和 PlatformTextField 删除项目页局部弹窗与输入框样式 补充 TRACKING 组件复用记录
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
Plus,
|
||||
Square,
|
||||
Trash2,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
|
||||
@@ -20,6 +19,8 @@ import {
|
||||
import { PlatformActionButton } from '../common/PlatformActionButton';
|
||||
import { PlatformEmptyState } from '../common/PlatformEmptyState';
|
||||
import { PlatformIconButton } from '../common/PlatformIconButton';
|
||||
import { PlatformTextField } from '../common/PlatformTextField';
|
||||
import { UnifiedModal } from '../common/UnifiedModal';
|
||||
|
||||
type ProjectGalleryViewProps = {
|
||||
onOpenProject: (projectId: string) => void;
|
||||
@@ -327,26 +328,36 @@ export function ProjectGalleryView({ onOpenProject }: ProjectGalleryViewProps) {
|
||||
<section className="project-gallery__grid">{projectCards}</section>
|
||||
)}
|
||||
|
||||
{renameDraft ? (
|
||||
<div className="project-gallery__modal-backdrop" role="presentation">
|
||||
<UnifiedModal
|
||||
open={Boolean(renameDraft)}
|
||||
title="重命名"
|
||||
size="sm"
|
||||
closeLabel="关闭重命名"
|
||||
onClose={() => setRenameDraft(null)}
|
||||
footer={
|
||||
<>
|
||||
<PlatformActionButton
|
||||
type="button"
|
||||
tone="secondary"
|
||||
onClick={() => setRenameDraft(null)}
|
||||
>
|
||||
取消
|
||||
</PlatformActionButton>
|
||||
<PlatformActionButton type="submit" form="project-gallery-rename-form">
|
||||
保存
|
||||
</PlatformActionButton>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{renameDraft ? (
|
||||
<form
|
||||
className="project-gallery__rename-dialog"
|
||||
id="project-gallery-rename-form"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
submitRename();
|
||||
}}
|
||||
>
|
||||
<div className="project-gallery__rename-header">
|
||||
<h2>重命名</h2>
|
||||
<PlatformIconButton
|
||||
label="关闭重命名"
|
||||
icon={<X className="h-4 w-4" />}
|
||||
variant="surfaceFloating"
|
||||
className="h-8 w-8"
|
||||
onClick={() => setRenameDraft(null)}
|
||||
/>
|
||||
</div>
|
||||
<input
|
||||
<PlatformTextField
|
||||
aria-label="项目名称"
|
||||
value={renameDraft.title}
|
||||
onChange={(event) =>
|
||||
@@ -358,19 +369,9 @@ export function ProjectGalleryView({ onOpenProject }: ProjectGalleryViewProps) {
|
||||
}
|
||||
autoFocus
|
||||
/>
|
||||
<div className="project-gallery__rename-actions">
|
||||
<PlatformActionButton
|
||||
type="button"
|
||||
tone="secondary"
|
||||
onClick={() => setRenameDraft(null)}
|
||||
>
|
||||
取消
|
||||
</PlatformActionButton>
|
||||
<PlatformActionButton type="submit">保存</PlatformActionButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
) : null}
|
||||
) : null}
|
||||
</UnifiedModal>
|
||||
|
||||
{isSelectionMode ? (
|
||||
<div className="project-gallery__batch-toolbar" role="toolbar" aria-label="批量操作">
|
||||
|
||||
Reference in New Issue
Block a user