-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix checkout error & empty views (#1012)
- Loading branch information
1 parent
89996c8
commit 89aeaa8
Showing
9 changed files
with
86 additions
and
38 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { type ReactNode } from "react"; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
export const ErrorContentWrapper = ({ children }: Props) => { | ||
return ( | ||
<div className="mx-auto flex max-w-screen-sm flex-col items-center gap-y-4 bg-neutral-50 px-8 py-16 text-center"> | ||
<>{children}</> | ||
</div> | ||
); | ||
}; |
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,27 @@ | ||
import { type ReactNode, type AnchorHTMLAttributes } from "react"; | ||
import clsx from "clsx"; | ||
|
||
type Props = AnchorHTMLAttributes<HTMLAnchorElement> & { | ||
children: ReactNode; | ||
href: string; | ||
variant?: "primary" | "secondary" | "tertiary"; | ||
}; | ||
|
||
export const LinkAsButton = ({ children, href, variant = "primary" }: Props) => { | ||
const classes = clsx( | ||
"inline-flex h-10 items-center justify-center whitespace-nowrap rounded border active:outline-none font-bold", | ||
{ | ||
"bg-neutral-900 hover:bg-neutral-800 disabled:bg-neutral-700 text-white px-4 aria-disabled:cursor-not-allowed aria-disabled:opacity-70 hover:aria-disabled:bg-neutral-700": | ||
variant === "primary", | ||
"border-neutral-600 hover:border-neutral-700 hover:bg-neutral-300 active:bg-neutral-300 disabled:border-neutral-300 aria-disabled:border-neutral-300 bg-transparent disabled:bg-transparent aria-disabled:bg-transparent px-4": | ||
variant === "secondary", | ||
"h-auto border-none bg-transparent p-0": variant === "tertiary", | ||
}, | ||
); | ||
|
||
return ( | ||
<a href={href} className={classes}> | ||
{children} | ||
</a> | ||
); | ||
}; |
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
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import React from "react"; | ||
import { Title } from "@/checkout/components"; | ||
import { LinkAsButton } from "@/checkout/components/LinkAsButton"; | ||
import { ErrorContentWrapper } from "@/checkout/components/ErrorContentWrapper"; | ||
|
||
export const EmptyCartPage = () => { | ||
return ( | ||
<div className="flex w-full flex-row justify-center lg:mt-10"> | ||
<div className="flex flex-col justify-start rounded-lg border border-neutral-400 py-6"> | ||
<Title>Your cart is empty</Title> | ||
<p>Add anything to the cart to continue</p> | ||
<a className="mt-3 md:self-end" href="/"> | ||
Go back to store | ||
</a> | ||
</div> | ||
</div> | ||
<ErrorContentWrapper> | ||
<Title className="mb-0 text-xl">Your cart is empty</Title> | ||
<p>Add anything to the cart to continue.</p> | ||
<LinkAsButton href="/" variant="secondary"> | ||
Go back to store | ||
</LinkAsButton> | ||
</ErrorContentWrapper> | ||
); | ||
}; |
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