Skip to content

Commit 69b9517

Browse files
committed
refactor: update component styles and improve layout with new utility classes
1 parent f17e82a commit 69b9517

File tree

20 files changed

+66
-49
lines changed

20 files changed

+66
-49
lines changed

frontend/src/components/CardView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ function CardView<T extends BaseCardDataType>(props: CardViewProps<T>) {
168168
const ops = (item) =>
169169
typeof operations === "function" ? operations(item) : operations;
170170
return (
171-
<div className="flex-1 flex flex-col overflow-auto">
172-
<div className="overflow-auto grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4">
171+
<div className="flex-overflow-hidden">
172+
<div className="flex-overflow-auto grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4">
173173
{data.map((item) => (
174174
<div
175175
key={item.id}
176-
className="border border-gray-100 rounded-lg p-4 bg-white hover:shadow-lg transition-shadow duration-200"
176+
className="border-card p-4 bg-white hover:shadow-lg transition-shadow duration-200"
177177
>
178178
<div className="flex flex-col space-y-4 h-full">
179179
{/* Header */}

frontend/src/components/DetailHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function DetailHeader<T>({
4848
<div className="flex items-start justify-between">
4949
<div className="flex items-start gap-4 flex-1">
5050
<div
51-
className={`w-16 h-16 text-white rounded-xl flex items-center justify-center shadow-lg ${
51+
className={`w-16 h-16 text-white rounded-lg flex-center shadow-lg ${
5252
data?.iconColor
5353
? data.iconColor
5454
: "bg-gradient-to-br from-blue-100 to-blue-200"

frontend/src/components/RadioCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const RadioCard: React.FC<RadioCardProps> = ({
3232
{options.map((option) => (
3333
<div
3434
key={option.value}
35-
className="border border-gray-200 rounded-lg hover:shadow-lg p-4 text-center"
35+
className="border-card hover:shadow-lg p-4 text-center"
3636
style={{
3737
borderColor: value === option.value ? "#1677ff" : undefined,
3838
background: value === option.value ? "#e6f7ff" : undefined,

frontend/src/components/TagManagement.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function CustomTag({
3030
return (
3131
<div
3232
key={tag.id}
33-
className="flex items-center justify-between px-4 py-2 border border-gray-100 rounded-md hover:bg-gray-50"
33+
className="flex items-center justify-between px-4 py-2 border-card hover:bg-gray-50"
3434
>
3535
{editingTag?.id === tag.id ? (
3636
<div className="flex gap-2 flex-1">
@@ -199,7 +199,7 @@ const TagManager: React.FC = ({
199199
title="标签管理"
200200
width={500}
201201
>
202-
<div className="space-y-4 flex flex-col overflow-y-auto h-full">
202+
<div className="space-y-4 flex-overflow">
203203
{/* Add New Tag */}
204204
<div className="flex gap-2">
205205
<Input
@@ -223,7 +223,7 @@ const TagManager: React.FC = ({
223223
</Button>
224224
</div>
225225

226-
<div className="flex-1 overflow-auto">
226+
<div className="flex-overflow">
227227
<div className="overflow-auto grid grid-cols-2 gap-2">
228228
{tags.map((tag) => (
229229
<CustomTag

frontend/src/components/TaskPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default function TaskPopover() {
8989
{tasks.map((task) => (
9090
<div
9191
key={task.id}
92-
className="p-3 border border-gray-100 rounded-lg hover:bg-gray-50"
92+
className="p-3 border-card hover:bg-gray-50"
9393
>
9494
<div className="space-y-2">
9595
<div className="flex items-center justify-between">

frontend/src/index.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,28 @@
4242
opacity: 100%;
4343
visibility: visible;
4444
transform: translateX(0);
45-
}
45+
}
46+
47+
@layer components {
48+
.flex-center {
49+
@apply flex items-center justify-center;
50+
}
51+
.flex-overflow-auto {
52+
@apply flex-1 flex flex-col overflow-auto h-full;
53+
}
54+
.flex-overflow-hidden {
55+
@apply flex flex-col h-full overflow-hidden;
56+
}
57+
.border-card {
58+
@apply border border-[#f0f0f0] rounded-lg bg-white;
59+
}
60+
.border {
61+
@apply border border-gray-100;
62+
}
63+
.border-bottom {
64+
@apply border-b border-gray-100;
65+
}
66+
.border-top {
67+
@apply border-t border-gray-100;
68+
}
69+
}

frontend/src/pages/DataAnnotation/Annotate/components/ImageAnnotation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ export default function ImageAnnotationWorkspace({
429429
}`}
430430
onClick={() => setSelectedImageIndex(index)}
431431
>
432-
<div className="w-8 h-8 bg-gray-200 rounded flex items-center justify-center text-sm font-medium mr-3">
432+
<div className="w-8 h-8 bg-gray-200 rounded flex-center text-sm font-medium mr-3">
433433
{index + 1}
434434
</div>
435435
<img
@@ -462,7 +462,7 @@ export default function ImageAnnotationWorkspace({
462462
</div>
463463
</div>
464464

465-
<div className="flex-1 border rounded-lg overflow-hidden bg-gray-100 relative">
465+
<div className="flex-1 border-card overflow-hidden bg-gray-100 relative">
466466
<canvas
467467
ref={canvasRef}
468468
width={800}

frontend/src/pages/DataAnnotation/Create/CreateTask.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default function AnnotationTaskCreate() {
123123
};
124124

125125
return (
126-
<div className="h-full flex flex-col overflow-auto">
126+
<div className="flex-overflow-auto">
127127
{/* Header */}
128128
<div className="flex items-center mb-2">
129129
<Link to="/data/annotation">
@@ -134,7 +134,7 @@ export default function AnnotationTaskCreate() {
134134
<h1 className="text-xl font-bold bg-clip-text">创建标注任务</h1>
135135
</div>
136136

137-
<div className="h-full flex-1 overflow-y-auto flex flex-col bg-white rounded-lg shadow-sm">
137+
<div className="flex-overflow-auto bg-white rounded-lg shadow-sm">
138138
<div className="flex-1 overflow-y-auto p-6">
139139
<Form
140140
form={form}

frontend/src/pages/DataCleansing/Create/CreateTask.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ export default function CleansingTaskCreate() {
101101
</div>
102102
</div>
103103
{/* Step Content */}
104-
<div className="h-full mb-4 flex flex-col overflow-auto flex-1 bg-white rounded shadow-sm">
104+
<div className="flex-overflow-auto bg-white border-card">
105105
<div className="flex-1 overflow-auto m-6">{renderStepContent()}</div>
106-
<div className="flex justify-end p-6 gap-3 border-t border-gray-200">
106+
<div className="flex justify-end p-6 gap-3 border-top">
107107
<Button onClick={() => navigate("/data/cleansing")}>取消</Button>
108108
{currentStep > 1 && <Button onClick={handlePrev}>上一步</Button>}
109109
{currentStep === 2 ? (

frontend/src/pages/DataCleansing/Create/CreateTempate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ export default function CleansingTemplateCreate() {
9090
</div>
9191
</div>
9292

93-
<div className="h-full mb-4 flex flex-col overflow-auto flex-1 bg-white rounded shadow-sm">
93+
<div className="flex-overflow-auto border-card">
9494
<div className="flex-1 overflow-auto m-6">{renderStepContent()}</div>
95-
<div className="flex justify-end p-6 gap-3 border-t border-gray-200">
95+
<div className="flex justify-end p-6 gap-3 border-top">
9696
<Button onClick={() => navigate("/data/cleansing")}>取消</Button>
9797
{currentStep > 1 && <Button onClick={handlePrev}>上一步</Button>}
9898
{currentStep === 2 ? (

0 commit comments

Comments
 (0)