Skip to content

Commit

Permalink
Add cancel button in repository form (#4403)
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalabbad authored Sep 20, 2024
1 parent c96d27f commit 79b7e20
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/4402.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added cancel button in repository form
22 changes: 19 additions & 3 deletions frontend/app/src/screens/repository/repository-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ import { DynamicInput } from "@/components/form/dynamic-form";
import { NodeFormProps } from "@/components/form/node-form";
import { createObject } from "@/graphql/mutations/objects/createObject";
import RelationshipField from "@/components/form/fields/relationship.field";

const RepositoryForm = ({ onSuccess, schema, currentObject, onSubmit }: NodeFormProps) => {
import { Button } from "@/components/buttons/button-primitive";
import React from "react";

const RepositoryForm = ({
onSuccess,
schema,
currentObject,
onSubmit,
onCancel,
}: NodeFormProps) => {
const branch = useAtomValue(currentBranchAtom);
const date = useAtomValue(datetimeAtom);
const auth = useAuth();
Expand Down Expand Up @@ -95,7 +103,15 @@ const RepositoryForm = ({ onSuccess, schema, currentObject, onSubmit }: NodeForm
</FormGroup>
)}

<FormSubmit className="float-right">Save</FormSubmit>
<div className="text-right">
{onCancel && (
<Button variant="outline" className="mr-2" onClick={onCancel}>
Cancel
</Button>
)}

<FormSubmit>Save</FormSubmit>
</div>
</Form>
);
};
Expand Down

0 comments on commit 79b7e20

Please sign in to comment.