diff --git a/components/cart/CartSidebarView/CartSidebarView.tsx b/components/cart/CartSidebarView/CartSidebarView.tsx
index 74c388bfb..5d55e17da 100644
--- a/components/cart/CartSidebarView/CartSidebarView.tsx
+++ b/components/cart/CartSidebarView/CartSidebarView.tsx
@@ -5,6 +5,7 @@ import { Trash, Cross } from '@components/icon'
import { useUI } from '@components/ui/context'
import { useCart } from '@lib/bigcommerce/cart'
import CartItem from '../CartItem'
+import Link from '@components/ui/Link'
const CartSidebarView: FC = () => {
const { data, isEmpty } = useCart()
@@ -60,7 +61,9 @@ const CartSidebarView: FC = () => {
-
+
>
)}
diff --git a/components/ui/Button/Button.module.css b/components/ui/Button/Button.module.css
index bdc88bb33..28f04386c 100644
--- a/components/ui/Button/Button.module.css
+++ b/components/ui/Button/Button.module.css
@@ -10,7 +10,7 @@
@apply border-gray-700 shadow-outline;
}
-.root:active {
+.root[data-active] {
@apply bg-gray-700;
}
diff --git a/components/ui/Button/Button.tsx b/components/ui/Button/Button.tsx
index 362ade2ae..c8e78fb45 100644
--- a/components/ui/Button/Button.tsx
+++ b/components/ui/Button/Button.tsx
@@ -1,5 +1,10 @@
import cn from 'classnames'
-import React, { ButtonHTMLAttributes } from 'react'
+import React, {
+ ButtonHTMLAttributes,
+ JSXElementConstructor,
+ useRef,
+} from 'react'
+import { useButton } from 'react-aria'
import s from './Button.module.css'
interface Props extends ButtonHTMLAttributes {
@@ -8,47 +13,55 @@ interface Props extends ButtonHTMLAttributes {
variant?: 'filled' | 'outlined' | 'flat' | 'none'
active?: boolean
type?: 'submit' | 'reset' | 'button'
+ Component?: string | JSXElementConstructor
}
-export default class Button extends React.Component {
- public render() {
- const {
- className,
- variant = 'filled',
- children,
- disabled = false,
- href,
- active,
- ...rest
- } = this.props
+const Button: React.FC = (props) => {
+ const {
+ className,
+ variant = 'filled',
+ children,
+ href,
+ active,
+ onClick,
+ disabled,
+ Component = 'button',
+ ...rest
+ } = props
+ const ref = useRef(null)
+ const { buttonProps, isPressed } = useButton(
+ {
+ ...props,
+ // @ts-ignore onClick === onPress for our purposes
+ onPress: onClick,
+ isDisabled: disabled,
+ elementType: Component,
+ },
+ ref
+ )
- let Component: React.ComponentType<
- React.AnchorHTMLAttributes<
- HTMLAnchorElement | HTMLButtonElement | HTMLDivElement
- > &
- React.ClassAttributes
- > = 'a' as any
+ const rootClassName = cn(
+ s.root,
+ {
+ [s.filled]: variant === 'filled',
+ },
+ className
+ )
- // Catch for buttons / span / stc.
-
- const rootClassName = cn(
- s.root,
- {
- [s.filled]: variant === 'filled',
- },
- className
- )
-
- return (
-
- {children}
-
- )
- }
+ return (
+
+ {children}
+
+ )
}
+
+export default Button
diff --git a/components/ui/Link/Link.tsx b/components/ui/Link/Link.tsx
new file mode 100644
index 000000000..27f30e863
--- /dev/null
+++ b/components/ui/Link/Link.tsx
@@ -0,0 +1,11 @@
+import NextLink, { LinkProps as NextLinkProps } from 'next/link'
+
+const Link: React.FC = ({ href, children, ...props }) => {
+ return (
+
+ {children}
+
+ )
+}
+
+export default Link
diff --git a/components/ui/Link/index.ts b/components/ui/Link/index.ts
new file mode 100644
index 000000000..518d37298
--- /dev/null
+++ b/components/ui/Link/index.ts
@@ -0,0 +1 @@
+export { default } from './Link'