-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make changes in existing files in place instead separate an…
…d move to the components in src/ui directory
- Loading branch information
1 parent
57dfc2c
commit 92625e3
Showing
5 changed files
with
53 additions
and
44 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { SubmitButton } from "./SubmitButton"; | ||
import { deleteLineFromCheckout } from "./actions"; | ||
|
||
type Props = { | ||
lineId: string; | ||
checkoutId: string; | ||
}; | ||
|
||
export const DeleteLineForm = ({ lineId, checkoutId }: Props) => { | ||
return ( | ||
<form action={deleteLineFromCheckout}> | ||
<input type="hidden" name="checkoutId" value={checkoutId} /> | ||
<input type="hidden" name="lineId" value={lineId} /> | ||
<SubmitButton /> | ||
</form> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use client"; | ||
|
||
import { useFormStatus } from "react-dom"; | ||
|
||
export const SubmitButton = () => { | ||
const { pending } = useFormStatus(); | ||
|
||
return ( | ||
<button type="submit" className="text-sm text-neutral-500 hover:text-neutral-900" aria-disabled={pending}> | ||
{pending ? "Removing" : "Remove"} | ||
<span className="sr-only">line from cart</span> | ||
</button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters