Skip to content

Commit 79b7e20

Browse files
authored
Add cancel button in repository form (#4403)
1 parent c96d27f commit 79b7e20

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

changelog/4402.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added cancel button in repository form

frontend/app/src/screens/repository/repository-form.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,16 @@ import { DynamicInput } from "@/components/form/dynamic-form";
1414
import { NodeFormProps } from "@/components/form/node-form";
1515
import { createObject } from "@/graphql/mutations/objects/createObject";
1616
import RelationshipField from "@/components/form/fields/relationship.field";
17-
18-
const RepositoryForm = ({ onSuccess, schema, currentObject, onSubmit }: NodeFormProps) => {
17+
import { Button } from "@/components/buttons/button-primitive";
18+
import React from "react";
19+
20+
const RepositoryForm = ({
21+
onSuccess,
22+
schema,
23+
currentObject,
24+
onSubmit,
25+
onCancel,
26+
}: NodeFormProps) => {
1927
const branch = useAtomValue(currentBranchAtom);
2028
const date = useAtomValue(datetimeAtom);
2129
const auth = useAuth();
@@ -95,7 +103,15 @@ const RepositoryForm = ({ onSuccess, schema, currentObject, onSubmit }: NodeForm
95103
</FormGroup>
96104
)}
97105

98-
<FormSubmit className="float-right">Save</FormSubmit>
106+
<div className="text-right">
107+
{onCancel && (
108+
<Button variant="outline" className="mr-2" onClick={onCancel}>
109+
Cancel
110+
</Button>
111+
)}
112+
113+
<FormSubmit>Save</FormSubmit>
114+
</div>
99115
</Form>
100116
);
101117
};

0 commit comments

Comments
 (0)