From 8df60777984fe12997d88c72e78ffe3b9f86160a Mon Sep 17 00:00:00 2001 From: Aleksey Razorvin <> Date: Sat, 21 Mar 2026 13:42:07 +0500 Subject: [PATCH] feat: add back button to test edit form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TestForm now accepts optional onBack/backLabel props. TestEdit passes 'К просмотру теста' back button when in edit mode. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/components/TestForm/index.tsx | 16 +++++++++++++++- frontend/src/pages/TestEdit/index.tsx | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/TestForm/index.tsx b/frontend/src/components/TestForm/index.tsx index 4c20b22..ceee10e 100644 --- a/frontend/src/components/TestForm/index.tsx +++ b/frontend/src/components/TestForm/index.tsx @@ -1,4 +1,4 @@ -import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' +import { ArrowLeftOutlined, MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' import { Button, Card, @@ -11,6 +11,7 @@ import { Typography, } from 'antd' + const { Title } = Typography const EMPTY_ANSWER = { text: '', is_correct: false } @@ -33,6 +34,8 @@ interface TestFormProps { isPending: boolean submitLabel: string onCancel: () => void + onBack?: () => void + backLabel?: string } export default function TestForm({ @@ -42,6 +45,8 @@ export default function TestForm({ isPending, submitLabel, onCancel, + onBack, + backLabel = 'Назад', }: TestFormProps) { const [form] = Form.useForm() @@ -55,6 +60,15 @@ export default function TestForm({ return (
+ {onBack && ( + + )} {heading}
diff --git a/frontend/src/pages/TestEdit/index.tsx b/frontend/src/pages/TestEdit/index.tsx index cb0e7ed..fb334d4 100644 --- a/frontend/src/pages/TestEdit/index.tsx +++ b/frontend/src/pages/TestEdit/index.tsx @@ -92,6 +92,8 @@ export default function TestEdit() { isPending={isPending} submitLabel="Сохранить" onCancel={() => setEditMode(false)} + onBack={() => setEditMode(false)} + backLabel="К просмотру теста" /> ) }