forked from crowetic/commerce
Changes
This commit is contained in:
parent
4d4e4f667e
commit
60368e8858
@ -6,11 +6,12 @@ import React, { FC } from 'react'
|
|||||||
import { useUI } from '@components/ui/context'
|
import { useUI } from '@components/ui/context'
|
||||||
import { Navbar, Footer } from '@components/common'
|
import { Navbar, Footer } from '@components/common'
|
||||||
import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
|
import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
|
||||||
import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
|
|
||||||
import { Sidebar, Button, Modal, LoadingDots } from '@components/ui'
|
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 { 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 = () => (
|
const Loading = () => (
|
||||||
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
|
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
|
||||||
<LoadingDots />
|
<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."
|
title="This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy."
|
||||||
hide={acceptedCookies}
|
hide={acceptedCookies}
|
||||||
action={
|
action={
|
||||||
<Button className="mx-5" onClick={onAcceptCookies}>
|
<Button className="mx-5" onClick={() => onAcceptCookies()}>
|
||||||
Accept cookies
|
Accept cookies
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,12 @@ const Button: React.FC<ButtonProps> = forwardRef((props, buttonRef) => {
|
|||||||
variant = 'flat',
|
variant = 'flat',
|
||||||
children,
|
children,
|
||||||
active,
|
active,
|
||||||
onClick,
|
|
||||||
width,
|
width,
|
||||||
Component = 'button',
|
|
||||||
loading = false,
|
loading = false,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
style = {},
|
style = {},
|
||||||
|
Component = 'button',
|
||||||
|
...rest
|
||||||
} = props
|
} = props
|
||||||
const ref = useRef<typeof Component>(null)
|
const ref = useRef<typeof Component>(null)
|
||||||
|
|
||||||
@ -57,6 +57,7 @@ const Button: React.FC<ButtonProps> = forwardRef((props, buttonRef) => {
|
|||||||
width,
|
width,
|
||||||
...style,
|
...style,
|
||||||
}}
|
}}
|
||||||
|
{...rest}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
{loading && (
|
{loading && (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState } from 'react'
|
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
const COOKIE_NAME = 'accept_cookies'
|
const COOKIE_NAME = 'accept_cookies'
|
||||||
|
|
||||||
@ -14,9 +14,7 @@ export const useAcceptCookies = () => {
|
|||||||
|
|
||||||
const acceptCookies = () => {
|
const acceptCookies = () => {
|
||||||
setAcceptedCookies(true)
|
setAcceptedCookies(true)
|
||||||
Cookies.set(COOKIE_NAME, 'accepted', {
|
Cookies.set(COOKIE_NAME, 'accepted', { expires: 365 })
|
||||||
expires: 365,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user