4
0
forked from crowetic/commerce
This commit is contained in:
Bel Curcio 2020-12-08 10:43:44 -03:00
parent 4d4e4f667e
commit 60368e8858
3 changed files with 9 additions and 9 deletions

View File

@ -6,11 +6,12 @@ import React, { FC } from 'react'
import { useUI } from '@components/ui/context'
import { Navbar, Footer } from '@components/common'
import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
import { Sidebar, Button, Modal, LoadingDots } from '@components/ui'
import type { Page } from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages'
import { CartSidebarView } from '@components/cart'
import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
import type { Page } from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages'
const Loading = () => (
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
<LoadingDots />
@ -76,7 +77,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
title="This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy."
hide={acceptedCookies}
action={
<Button className="mx-5" onClick={onAcceptCookies}>
<Button className="mx-5" onClick={() => onAcceptCookies()}>
Accept cookies
</Button>
}

View File

@ -27,12 +27,12 @@ const Button: React.FC<ButtonProps> = forwardRef((props, buttonRef) => {
variant = 'flat',
children,
active,
onClick,
width,
Component = 'button',
loading = false,
disabled = false,
style = {},
Component = 'button',
...rest
} = props
const ref = useRef<typeof Component>(null)
@ -57,6 +57,7 @@ const Button: React.FC<ButtonProps> = forwardRef((props, buttonRef) => {
width,
...style,
}}
{...rest}
>
{children}
{loading && (

View File

@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import Cookies from 'js-cookie'
import { useEffect, useState } from 'react'
const COOKIE_NAME = 'accept_cookies'
@ -14,9 +14,7 @@ export const useAcceptCookies = () => {
const acceptCookies = () => {
setAcceptedCookies(true)
Cookies.set(COOKIE_NAME, 'accepted', {
expires: 365,
})
Cookies.set(COOKIE_NAME, 'accepted', { expires: 365 })
}
return {