@luxfi/ui 5.5.3 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -0
- package/package.json +81 -73
- package/commerce/ui/conf.ts +0 -13
- package/commerce/ui/context.tsx +0 -123
- package/commerce/ui/store.ts +0 -295
- package/components/access-code-input.tsx +0 -71
- package/components/analytics.tsx +0 -23
- package/components/auth/auth-listener.tsx +0 -29
- package/components/auth/auth-token/clear-auth-token.tsx +0 -12
- package/components/auth/auth-token/set-auth-token.tsx +0 -16
- package/components/auth/common-auth-domains.ts +0 -17
- package/components/auth/login-panel.tsx +0 -111
- package/components/auth/mobile-login-button.tsx +0 -107
- package/components/auth/signup-panel.tsx +0 -113
- package/components/back-button.tsx +0 -49
- package/components/chat-widget.tsx +0 -85
- package/components/commerce/bag-button.tsx +0 -98
- package/components/commerce/buy-button.tsx +0 -34
- package/components/commerce/checkout-button.tsx +0 -129
- package/components/commerce/checkout-panel/cart-accordian.tsx +0 -66
- package/components/commerce/checkout-panel/checkout-panel-props.ts +0 -10
- package/components/commerce/checkout-panel/desktop-bag-carousel.tsx +0 -36
- package/components/commerce/checkout-panel/desktop-cp.tsx +0 -83
- package/components/commerce/checkout-panel/index.tsx +0 -126
- package/components/commerce/checkout-panel/mobile-cp.tsx +0 -67
- package/components/commerce/checkout-panel/policy-links.tsx +0 -29
- package/components/commerce/checkout-panel/steps-indicator.tsx +0 -39
- package/components/commerce/checkout-panel/thank-you.tsx +0 -18
- package/components/commerce/desktop-bag-popup.tsx +0 -78
- package/components/commerce/drawer/index.tsx +0 -88
- package/components/commerce/drawer/micro.tsx +0 -145
- package/components/commerce/drawer/shell.tsx +0 -85
- package/components/contact-dialog/contact-form.tsx +0 -116
- package/components/contact-dialog/disclaimer.tsx +0 -13
- package/components/contact-dialog/index.tsx +0 -64
- package/components/copyright.tsx +0 -21
- package/components/drawer-margin.tsx +0 -28
- package/components/footer.tsx +0 -78
- package/components/header/desktop-nav-menu.tsx +0 -204
- package/components/header/desktop.tsx +0 -65
- package/components/header/index.tsx +0 -50
- package/components/header/mobile-bag-drawer.tsx +0 -51
- package/components/header/mobile-menu-toggle-button.tsx +0 -35
- package/components/header/mobile-nav-menu-ai.tsx +0 -51
- package/components/header/mobile-nav-menu-item.tsx +0 -47
- package/components/header/mobile-nav-menu.tsx +0 -102
- package/components/header/mobile.tsx +0 -170
- package/components/header/theme-toggle.tsx +0 -26
- package/components/icons/avatar.tsx +0 -11
- package/components/icons/bag-icon.tsx +0 -10
- package/components/icons/index.ts +0 -6
- package/components/icons/left-arrow.tsx +0 -11
- package/components/icons/lux-logo.tsx +0 -10
- package/components/icons/right-arrow.tsx +0 -10
- package/components/icons/social-icon.tsx +0 -35
- package/components/icons/social-svg.css +0 -3
- package/components/index.ts +0 -26
- package/components/logo.tsx +0 -92
- package/components/main.tsx +0 -27
- package/components/mini-chart/index.tsx +0 -8
- package/components/mini-chart/mini-chart-props.ts +0 -44
- package/components/mini-chart/mini-chart.tsx +0 -85
- package/components/mini-chart/wrapper.tsx +0 -23
- package/components/not-found/index.tsx +0 -28
- package/components/not-found/not-found-content.mdx +0 -5
- package/components/tooltip.tsx +0 -31
- package/environment.d.ts +0 -6
- package/next/analytics/fpixel.ts +0 -16
- package/next/analytics/google-analytics.ts +0 -14
- package/next/analytics/index.ts +0 -3
- package/next/analytics/pixel-analytics.tsx +0 -55
- package/next/font/get-app-router-font-classes.ts +0 -17
- package/next/font/load-and-return-lux-next-fonts-on-import.ts +0 -68
- package/next/font/local/Druk-Wide-Bold.ttf +0 -0
- package/next/font/local/Druk-Wide-Medium.ttf +0 -0
- package/next/font/local/InterVariable-Italic.ttf +0 -0
- package/next/font/local/InterVariable-Italic.woff2 +0 -0
- package/next/font/local/InterVariable.ttf +0 -0
- package/next/font/local/InterVariable.woff2 +0 -0
- package/next/font/next-font-desc.ts +0 -28
- package/next/font/pages-router-font-vars.tsx +0 -18
- package/next/head-metadata/from-next/metadata-types.ts +0 -158
- package/next/head-metadata/from-next/opengraph-types.ts +0 -267
- package/next/head-metadata/from-next/twitter-types.ts +0 -92
- package/next/head-metadata/index.tsx +0 -208
- package/next/index.ts +0 -2
- package/next/middleware/determine-device-mw.ts +0 -29
- package/root-layout/WHY_THIS_IS_SEPARATE.txt +0 -2
- package/root-layout/index.tsx +0 -112
- package/site-def/footer/community.tsx +0 -61
- package/site-def/footer/company.ts +0 -37
- package/site-def/footer/ecosystem.ts +0 -37
- package/site-def/footer/index.tsx +0 -26
- package/site-def/footer/legal.ts +0 -28
- package/site-def/footer/network.ts +0 -45
- package/site-def/footer/svg/warpcast-logo.svg +0 -12
- package/site-def/index.ts +0 -4
- package/site-def/main-nav.tsx +0 -460
- package/style/cart-animation.css +0 -29
- package/style/checkout-animation.css +0 -23
- package/style/drawer-handle-overrides.css +0 -160
- package/style/fonts/COPY_TO_PUBLIC_FOR_NON_NEXT.txt +0 -0
- package/style/fonts/Druk-Wide-Bold.ttf +0 -0
- package/style/fonts/Druk-Wide-Medium.ttf +0 -0
- package/style/fonts/InterVariable-Italic.ttf +0 -0
- package/style/fonts/InterVariable-Italic.woff2 +0 -0
- package/style/fonts/InterVariable.ttf +0 -0
- package/style/fonts/InterVariable.woff2 +0 -0
- package/style/lux-colors.css +0 -85
- package/style/lux-fonts.css +0 -30
- package/style/lux-global-non-next.css +0 -52
- package/style/lux-global.css +0 -51
- package/tailwind/fontFamily.tailwind.lux.ts +0 -18
- package/tailwind/index.ts +0 -2
- package/tailwind/lux-tw-fonts.ts +0 -40
- package/tailwind/tailwind.config.lux-preset.ts +0 -10
- package/tsconfig.json +0 -15
- package/types/chatbot-config.ts +0 -7
- package/types/chatbot-suggested-question.ts +0 -7
- package/types/contact-info.ts +0 -11
- package/types/index.ts +0 -4
- package/types/site-def.ts +0 -46
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import Link from 'next/link'
|
|
4
|
-
import { useRouter } from 'next/navigation'
|
|
5
|
-
|
|
6
|
-
import { setCookie } from 'cookies-next'
|
|
7
|
-
|
|
8
|
-
import { cn } from '@hanzo/ui/util'
|
|
9
|
-
import { Button, Carousel, CarouselContent, CarouselItem } from '@hanzo/ui/primitives'
|
|
10
|
-
import { LoginPanel as Login, SignupPanel as Signup } from '@hanzo/auth/components'
|
|
11
|
-
|
|
12
|
-
import { LuxLogo } from '../icons'
|
|
13
|
-
import Logo from '../logo'
|
|
14
|
-
import { EmblaAutoplay } from '..'
|
|
15
|
-
import { legal } from '../../site-def/footer'
|
|
16
|
-
|
|
17
|
-
const SignupPanel: React.FC<{
|
|
18
|
-
close: () => void
|
|
19
|
-
getStartedUrl?: string
|
|
20
|
-
redirectUrl?: string
|
|
21
|
-
className?: string
|
|
22
|
-
reviews: { text: string, author: string, href: string }[]
|
|
23
|
-
setIsLogin?: React.Dispatch<React.SetStateAction<boolean>>
|
|
24
|
-
}> = ({
|
|
25
|
-
close,
|
|
26
|
-
getStartedUrl = '/',
|
|
27
|
-
redirectUrl,
|
|
28
|
-
className = '',
|
|
29
|
-
reviews,
|
|
30
|
-
setIsLogin
|
|
31
|
-
}) => {
|
|
32
|
-
const router = useRouter()
|
|
33
|
-
|
|
34
|
-
const termsOfServiceUrl = legal.find(({ title }) => title === 'Terms and Conditions')?.href || ''
|
|
35
|
-
const privacyPolicyUrl = legal.find(({ title }) => title === 'Privacy Policy')?.href || ''
|
|
36
|
-
const domains = ['lux.id', 'lux.credit', 'lux.market', 'lux.network', 'lux.shop', 'wallet.lux.network', 'safe.lux.network', 'lux.finance', 'lux.exchange', 'lux.quest']
|
|
37
|
-
|
|
38
|
-
// TODO :aa shouldn't this happen in @hanzo/auth: components/LoginPanel ??
|
|
39
|
-
// Otherwise, the functionality is split across modules! (and client/fw!)
|
|
40
|
-
// (This was never my intent w the onLoginChanged callback.)
|
|
41
|
-
const onLogin = (token: string) => {
|
|
42
|
-
for (let i = 0; i < domains.length; i++) {
|
|
43
|
-
setCookie('auth-token', token, {
|
|
44
|
-
domain: domains[i],
|
|
45
|
-
path: '/',
|
|
46
|
-
sameSite: 'none',
|
|
47
|
-
secure: true,
|
|
48
|
-
httpOnly: false,
|
|
49
|
-
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
redirectUrl && router.push(redirectUrl)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div className={cn('grid grid-cols-1 md:grid-cols-2', className)}>
|
|
58
|
-
<div className='hidden md:flex w-full h-full bg-[radial-gradient(circle_at_24.1%_68.8%_,_rgba(15,14,14,0)_,_rgba(9,9,9,99.4))] flex-row items-end justify-end overflow-y-auto min-h-screen'>
|
|
59
|
-
<div className='h-full w-full max-w-[750px] px-8 pt-0'>
|
|
60
|
-
<div className='h-full w-full max-w-[550px] mx-auto flex flex-col justify-between min-h-screen py-10'>
|
|
61
|
-
<Button
|
|
62
|
-
variant='ghost'
|
|
63
|
-
onClick={close}
|
|
64
|
-
className='w-fit !min-w-0 p-2'
|
|
65
|
-
>
|
|
66
|
-
<Logo size='md' textClx='!cursor-pointer' variant='text-only' />
|
|
67
|
-
</Button>
|
|
68
|
-
<Carousel
|
|
69
|
-
options={{ align: 'center', loop: true }}
|
|
70
|
-
className='w-full'
|
|
71
|
-
plugins={[EmblaAutoplay({ delay: 5000, stopOnInteraction: true })]}
|
|
72
|
-
>
|
|
73
|
-
<CarouselContent>
|
|
74
|
-
{reviews.map(({ text, author, href }, index) => (
|
|
75
|
-
<CarouselItem key={index}>
|
|
76
|
-
<Link href={href} className='flex flex-col gap-3 cursor-pointer'>
|
|
77
|
-
<p>“{text}“</p>
|
|
78
|
-
<p className='text-sm'>{author}</p>
|
|
79
|
-
</Link>
|
|
80
|
-
</CarouselItem>
|
|
81
|
-
))}
|
|
82
|
-
</CarouselContent>
|
|
83
|
-
</Carousel>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
<div className='w-full h-full bg-background flex flex-row items-center'>
|
|
88
|
-
<div className='w-full max-w-[750px] relative flex flex-col items-center px-8 pt-0 text-center'>
|
|
89
|
-
<div className='relative h-full w-full max-w-[400px] mx-auto flex flex-col gap-4 items-center py-10'>
|
|
90
|
-
<Button
|
|
91
|
-
variant='ghost'
|
|
92
|
-
onClick={close}
|
|
93
|
-
className='block md:hidden absolute rounded-full p-2 left-0 h-auto hover:bg-background'
|
|
94
|
-
>
|
|
95
|
-
<LuxLogo className='w-5 h-5' />
|
|
96
|
-
</Button>
|
|
97
|
-
<Signup
|
|
98
|
-
getStartedUrl={getStartedUrl}
|
|
99
|
-
redirectUrl={redirectUrl}
|
|
100
|
-
className='w-full max-w-sm'
|
|
101
|
-
termsOfServiceUrl={termsOfServiceUrl}
|
|
102
|
-
privacyPolicyUrl={privacyPolicyUrl}
|
|
103
|
-
onLoginChanged={onLogin}
|
|
104
|
-
setIsLogin={setIsLogin}
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export default SignupPanel
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { useRouter } from 'next/navigation'
|
|
4
|
-
|
|
5
|
-
import { ChevronLeft } from 'lucide-react'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
Button,
|
|
10
|
-
buttonVariants,
|
|
11
|
-
} from '@hanzo/ui/primitives'
|
|
12
|
-
|
|
13
|
-
import type { VariantProps } from '@hanzo/ui/util'
|
|
14
|
-
|
|
15
|
-
const BackButton: React.FC<{
|
|
16
|
-
variant?: VariantProps<typeof buttonVariants>['variant']
|
|
17
|
-
size?: VariantProps<typeof buttonVariants>['size']
|
|
18
|
-
onBack?: () => void
|
|
19
|
-
clx?: string
|
|
20
|
-
iconClx?: string
|
|
21
|
-
}> = ({
|
|
22
|
-
variant='ghost',
|
|
23
|
-
size='default',
|
|
24
|
-
clx='',
|
|
25
|
-
iconClx='',
|
|
26
|
-
onBack
|
|
27
|
-
}) => {
|
|
28
|
-
|
|
29
|
-
const router = useRouter()
|
|
30
|
-
const back = () => {
|
|
31
|
-
if (onBack) {
|
|
32
|
-
onBack()
|
|
33
|
-
}
|
|
34
|
-
router.back()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Button
|
|
39
|
-
variant={variant}
|
|
40
|
-
size={size}
|
|
41
|
-
onClick={back}
|
|
42
|
-
className={clx}
|
|
43
|
-
>
|
|
44
|
-
<ChevronLeft className={iconClx}/>
|
|
45
|
-
</Button>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default BackButton
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { Button, Card } from '@hanzo/ui/primitives'
|
|
5
|
-
import { cn } from '@hanzo/ui/util'
|
|
6
|
-
|
|
7
|
-
import { LuxLogo } from './icons'
|
|
8
|
-
import type { ChatbotSuggestedQuestion } from '../types'
|
|
9
|
-
|
|
10
|
-
const ChatWidget: React.FC<{
|
|
11
|
-
title: string
|
|
12
|
-
chatbotUrl: string
|
|
13
|
-
subtitle?: string
|
|
14
|
-
question?: string
|
|
15
|
-
buttonClx?: string
|
|
16
|
-
/*
|
|
17
|
-
ChatBotSuggestQuestion.icon
|
|
18
|
-
Currently supports these icons from remix icons (https://remixicon.com/):
|
|
19
|
-
GlobalLineIcon,
|
|
20
|
-
ShieldFlashLineIcon,
|
|
21
|
-
BankCardLineIcon,
|
|
22
|
-
GroupLineIcon,
|
|
23
|
-
QuestionnaireLineIcon
|
|
24
|
-
*/
|
|
25
|
-
suggestedQuestions?: ChatbotSuggestedQuestion[]
|
|
26
|
-
}> = ({
|
|
27
|
-
title,
|
|
28
|
-
chatbotUrl,
|
|
29
|
-
subtitle,
|
|
30
|
-
question,
|
|
31
|
-
suggestedQuestions,
|
|
32
|
-
buttonClx=''
|
|
33
|
-
}) => {
|
|
34
|
-
|
|
35
|
-
const [showChatbot, setShowChatbot] = React.useState<boolean>(false)
|
|
36
|
-
|
|
37
|
-
const onClick = () => { setShowChatbot(!showChatbot) }
|
|
38
|
-
|
|
39
|
-
const searchParams = new URLSearchParams()
|
|
40
|
-
if (question) {
|
|
41
|
-
searchParams.append('question', question)
|
|
42
|
-
}
|
|
43
|
-
if (suggestedQuestions) {
|
|
44
|
-
searchParams.append('sQuestions', suggestedQuestions.map(({ message }) => message).join(','))
|
|
45
|
-
searchParams.append('sHeadings', suggestedQuestions.map(({ heading }) => heading).join(','))
|
|
46
|
-
searchParams.append('sIcons', suggestedQuestions.map(({ icon }) => icon).join(','))
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const iframeSrc = `${chatbotUrl}?${searchParams.toString()}`
|
|
50
|
-
|
|
51
|
-
return (<>
|
|
52
|
-
<div className={
|
|
53
|
-
'fixed bottom-0 sm:bottom-16 right-0 w-full h-full ' +
|
|
54
|
-
'sm:max-w-[400px] sm:max-h-[550px] sm:px-4 z-floating ' +
|
|
55
|
-
(showChatbot ? 'flex' : 'hidden')
|
|
56
|
-
}>
|
|
57
|
-
<Card className='flex flex-col h-full w-full'>
|
|
58
|
-
<div className='flex px-4 py-2 h-12 bg-level-0 items-center justify-between'>
|
|
59
|
-
<h1 className='font-semibold font-heading'>{title} <span className='opacity-60'>{subtitle}</span></h1>
|
|
60
|
-
<Button onClick={onClick} variant='link' size='icon' className='w-fit sm:hidden'>
|
|
61
|
-
<LuxLogo width={24} height={24}/>
|
|
62
|
-
</Button>
|
|
63
|
-
</div>
|
|
64
|
-
<iframe src={iframeSrc} className='h-full' />
|
|
65
|
-
</Card>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<LuxLogo
|
|
69
|
-
width={28}
|
|
70
|
-
height={28}
|
|
71
|
-
onClick={onClick}
|
|
72
|
-
className={cn(
|
|
73
|
-
// z-index should be below anything in commerce-iu (buy drawer and checkout widget)
|
|
74
|
-
'fixed bottom-5 right-[24px] md:z-floating z-16 cursor-pointer',
|
|
75
|
-
'hover:drop-shadow-[0_2px_6px_rgba(255,255,255,1)]',
|
|
76
|
-
'transition-transform',
|
|
77
|
-
showChatbot ? 'rotate-180' : '',
|
|
78
|
-
buttonClx
|
|
79
|
-
)}
|
|
80
|
-
strokeWidth={1}
|
|
81
|
-
/>
|
|
82
|
-
</>)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export default ChatWidget
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React, { useEffect, useRef } from 'react'
|
|
3
|
-
import { observable, type IObservableValue, reaction, runInAction } from 'mobx'
|
|
4
|
-
import { observer } from 'mobx-react-lite'
|
|
5
|
-
|
|
6
|
-
import { buttonVariants } from '@hanzo/ui/primitives'
|
|
7
|
-
import { cn, type VariantProps } from '@hanzo/ui/util'
|
|
8
|
-
import { useCommerce } from '@hanzo/commerce'
|
|
9
|
-
|
|
10
|
-
import { Bag } from '../icons'
|
|
11
|
-
|
|
12
|
-
const BagButton: React.FC<{
|
|
13
|
-
showIfEmpty?: boolean
|
|
14
|
-
animateOnHover?: boolean
|
|
15
|
-
animateOnQuantityChange?: boolean
|
|
16
|
-
size?: VariantProps<typeof buttonVariants>['size']
|
|
17
|
-
className?: string
|
|
18
|
-
iconClx?: string
|
|
19
|
-
onClick?: () => void
|
|
20
|
-
}> = observer(({
|
|
21
|
-
showIfEmpty=false,
|
|
22
|
-
animateOnHover=true,
|
|
23
|
-
animateOnQuantityChange=true,
|
|
24
|
-
size='default',
|
|
25
|
-
className='',
|
|
26
|
-
iconClx='',
|
|
27
|
-
onClick
|
|
28
|
-
}) => {
|
|
29
|
-
|
|
30
|
-
const c = useCommerce()
|
|
31
|
-
const wiggleRef = useRef<IObservableValue<'more' | 'less' | 'none'>>(observable.box('none'))
|
|
32
|
-
|
|
33
|
-
useEffect(() => (
|
|
34
|
-
// return IReactionDisposer
|
|
35
|
-
(animateOnQuantityChange && c) ? reaction(
|
|
36
|
-
() => (c.cartQuantity),
|
|
37
|
-
(curr, prev) => {
|
|
38
|
-
if (curr > prev) {
|
|
39
|
-
runInAction(() => {wiggleRef.current.set('more')})
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
runInAction(() => {wiggleRef.current.set('less')})
|
|
43
|
-
}
|
|
44
|
-
setTimeout(() => {
|
|
45
|
-
// Note that this doesn't actually stop the animation
|
|
46
|
-
// just resets the styles
|
|
47
|
-
runInAction(() => {wiggleRef.current.set('none')})
|
|
48
|
-
}, 800)
|
|
49
|
-
}
|
|
50
|
-
) : undefined
|
|
51
|
-
), [])
|
|
52
|
-
|
|
53
|
-
// undefined means context is not installed, ie commerce functions are not in use
|
|
54
|
-
if (!c || (!showIfEmpty && c.cartEmpty)) {
|
|
55
|
-
return <div /> // trigger code needs non-null
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<div
|
|
61
|
-
aria-label="Bag"
|
|
62
|
-
role='button'
|
|
63
|
-
onClick={onClick}
|
|
64
|
-
className={cn(
|
|
65
|
-
buttonVariants({ variant: 'ghost', size, rounded: 'md' }),
|
|
66
|
-
// Overides the bg change on hover --not a "hover effect"
|
|
67
|
-
'relative group p-0 aspect-square hover:bg-background',
|
|
68
|
-
((wiggleRef.current.get() === 'more') ?
|
|
69
|
-
'item-added-to-cart-animation'
|
|
70
|
-
:
|
|
71
|
-
(wiggleRef.current.get() === 'less') ? 'item-removed-from-cart-animation' : ''),
|
|
72
|
-
className
|
|
73
|
-
)}
|
|
74
|
-
>
|
|
75
|
-
{!c.cartEmpty && (
|
|
76
|
-
<div className={
|
|
77
|
-
'z-above-content flex flex-col justify-center items-center ' +
|
|
78
|
-
'absolute left-0 right-0 top-0 bottom-0 ' +
|
|
79
|
-
'leading-none font-sans font-bold text-primary-fg text-xs '
|
|
80
|
-
}>
|
|
81
|
-
<div className='h-[3px] w-full' />
|
|
82
|
-
<div>{c.cartQuantity}</div>
|
|
83
|
-
</div>
|
|
84
|
-
)}
|
|
85
|
-
<Bag width='24' height='28' className={cn(
|
|
86
|
-
'relative -top-[3px] fill-primary',
|
|
87
|
-
iconClx,
|
|
88
|
-
(animateOnHover ?
|
|
89
|
-
'group-hover:fill-primary-hover group-hover:scale-105 transition-scale transition-duration-300'
|
|
90
|
-
:
|
|
91
|
-
''
|
|
92
|
-
)
|
|
93
|
-
)} aria-hidden="true" />
|
|
94
|
-
</div>
|
|
95
|
-
)
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
export default BagButton
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React, {type PropsWithChildren} from 'react'
|
|
3
|
-
|
|
4
|
-
import { Button, buttonVariants } from '@hanzo/ui/primitives'
|
|
5
|
-
import { type VariantProps } from '@hanzo/ui/util'
|
|
6
|
-
|
|
7
|
-
import { cn } from '@hanzo/ui/util'
|
|
8
|
-
import { useSelectAndBuy } from '../../commerce/ui/context'
|
|
9
|
-
|
|
10
|
-
const BuyButton: React.FC<
|
|
11
|
-
PropsWithChildren &
|
|
12
|
-
VariantProps<typeof buttonVariants> &
|
|
13
|
-
{
|
|
14
|
-
skuPath: string
|
|
15
|
-
className?: string
|
|
16
|
-
}
|
|
17
|
-
> = ({
|
|
18
|
-
skuPath,
|
|
19
|
-
children,
|
|
20
|
-
className='',
|
|
21
|
-
...rest
|
|
22
|
-
}) => {
|
|
23
|
-
|
|
24
|
-
const buyOptions = useSelectAndBuy()
|
|
25
|
-
const handleClick = (): void => { buyOptions.showVariants(skuPath) }
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Button onClick={handleClick} {...rest} className={cn(className, '')}>
|
|
29
|
-
{children}
|
|
30
|
-
</Button>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default BuyButton
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React, { useEffect, useRef } from 'react'
|
|
3
|
-
import { observable, type IObservableValue, reaction, runInAction } from 'mobx'
|
|
4
|
-
import { observer } from 'mobx-react-lite'
|
|
5
|
-
|
|
6
|
-
import { Button, type ButtonProps } from '@hanzo/ui/primitives'
|
|
7
|
-
import { cn } from '@hanzo/ui/util'
|
|
8
|
-
import { useCommerce } from '@hanzo/commerce'
|
|
9
|
-
|
|
10
|
-
import { Bag } from '../icons'
|
|
11
|
-
|
|
12
|
-
const IconAndQuantity: React.FC<{
|
|
13
|
-
animateOnQuantityChange?: boolean
|
|
14
|
-
showArrow?: boolean
|
|
15
|
-
showQuantity?: boolean
|
|
16
|
-
clx?: string
|
|
17
|
-
iconClx?: string
|
|
18
|
-
digitClx?: string
|
|
19
|
-
}> = observer(({
|
|
20
|
-
animateOnQuantityChange=false,
|
|
21
|
-
showArrow=true,
|
|
22
|
-
showQuantity=true,
|
|
23
|
-
clx='',
|
|
24
|
-
iconClx='',
|
|
25
|
-
digitClx=''
|
|
26
|
-
}) => {
|
|
27
|
-
|
|
28
|
-
const cmmc = useCommerce()
|
|
29
|
-
const wiggleRef = useRef<IObservableValue<'more' | 'less' | 'none'>>(observable.box('none'))
|
|
30
|
-
|
|
31
|
-
useEffect(() => (
|
|
32
|
-
// return IReactionDisposer
|
|
33
|
-
animateOnQuantityChange ? reaction(
|
|
34
|
-
() => (cmmc.cartQuantity),
|
|
35
|
-
(curr, prev) => {
|
|
36
|
-
if (curr > prev) {
|
|
37
|
-
runInAction(() => {wiggleRef.current.set('more') })
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
runInAction(() => {wiggleRef.current.set('less') })
|
|
41
|
-
}
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
// Note that this doesn't actually stop the animation
|
|
44
|
-
// just resets the styles
|
|
45
|
-
runInAction(() => {wiggleRef.current.set('none') })
|
|
46
|
-
}, 800)
|
|
47
|
-
}
|
|
48
|
-
) : undefined
|
|
49
|
-
), [])
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<div className={cn('flex items-center justify-center', clx)}>
|
|
53
|
-
{showQuantity && (
|
|
54
|
-
<div className={cn(
|
|
55
|
-
'relative flex items-center justify-center mr-1',
|
|
56
|
-
((wiggleRef.current.get() === 'more') ?
|
|
57
|
-
'item-added-to-cart-animation'
|
|
58
|
-
:
|
|
59
|
-
(wiggleRef.current.get() === 'less') ? 'item-removed-from-cart-animation' : ''),
|
|
60
|
-
)} >
|
|
61
|
-
{cmmc.cartQuantity > 0 && (
|
|
62
|
-
<div className={cn(
|
|
63
|
-
'z-above-content flex flex-col justify-center items-center',
|
|
64
|
-
'absolute left-0 right-0 top-0 bottom-0',
|
|
65
|
-
digitClx
|
|
66
|
-
)}>
|
|
67
|
-
<div style={{/* color: 'white' tailwind bug? ,*/ fontSize: '11px', position: 'relative', top: '1px' }}>{cmmc.cartQuantity}</div>
|
|
68
|
-
</div>
|
|
69
|
-
)}
|
|
70
|
-
<Bag width='19' height='24' className={cn('relative -top-[3px] opacity-70' , iconClx)} aria-hidden="true" />
|
|
71
|
-
</div>
|
|
72
|
-
)}
|
|
73
|
-
{showArrow && (<span style={{fontSize: '17px',}}>›</span>)}
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const CheckoutButton: React.FC<ButtonProps & {
|
|
79
|
-
handleCheckout: () => void
|
|
80
|
-
showQuantity?: boolean
|
|
81
|
-
showArrow?: boolean
|
|
82
|
-
animateOnQuantityChange?: boolean
|
|
83
|
-
centerText?: boolean
|
|
84
|
-
}> = ({
|
|
85
|
-
handleCheckout,
|
|
86
|
-
variant='primary',
|
|
87
|
-
rounded='lg',
|
|
88
|
-
className,
|
|
89
|
-
showQuantity=true,
|
|
90
|
-
showArrow=true,
|
|
91
|
-
animateOnQuantityChange=true,
|
|
92
|
-
centerText=true,
|
|
93
|
-
children,
|
|
94
|
-
...rest
|
|
95
|
-
}) => {
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<Button
|
|
99
|
-
{...rest}
|
|
100
|
-
onClick={handleCheckout}
|
|
101
|
-
variant={variant}
|
|
102
|
-
rounded={rounded}
|
|
103
|
-
className={cn(
|
|
104
|
-
'flex justify-between items-stretch group',
|
|
105
|
-
showQuantity ? (centerText ? 'px-1.5' : 'pl-2.5 pr-1.5') : '',
|
|
106
|
-
className,
|
|
107
|
-
)}
|
|
108
|
-
>
|
|
109
|
-
{centerText && ( // must scale this one too, as it effects layout
|
|
110
|
-
<IconAndQuantity
|
|
111
|
-
showArrow={showArrow}
|
|
112
|
-
showQuantity={showQuantity}
|
|
113
|
-
clx='invisible group-hover:scale-105 transition-scale transition-duration-300'
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
{children ?? (<div className='flex justify-center items-center'>Checkout</div>)}
|
|
117
|
-
<IconAndQuantity
|
|
118
|
-
clx='group-hover:scale-105 transition-scale transition-duration-300'
|
|
119
|
-
animateOnQuantityChange={animateOnQuantityChange}
|
|
120
|
-
showArrow={showArrow}
|
|
121
|
-
showQuantity={showQuantity}
|
|
122
|
-
iconClx='fill-background'
|
|
123
|
-
digitClx='text-foreground group-hover:opacity-80 leading-none font-bold font-sans'
|
|
124
|
-
/>
|
|
125
|
-
</Button>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export default CheckoutButton
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { observer } from 'mobx-react-lite'
|
|
4
|
-
|
|
5
|
-
import { ChevronRight } from 'lucide-react'
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
Accordion,
|
|
9
|
-
AccordionContent,
|
|
10
|
-
AccordionItem,
|
|
11
|
-
AccordionTrigger,
|
|
12
|
-
} from '@hanzo/ui/primitives'
|
|
13
|
-
import { cn } from '@hanzo/ui/util'
|
|
14
|
-
|
|
15
|
-
import { useCommerce, CartPanel, formatCurrencyValue } from '@hanzo/commerce'
|
|
16
|
-
|
|
17
|
-
const CartAccordian: React.FC<{
|
|
18
|
-
icon?: React.ReactNode
|
|
19
|
-
clx?: string
|
|
20
|
-
triggerClx?: string
|
|
21
|
-
panelClx?: string
|
|
22
|
-
scrollAfter: number
|
|
23
|
-
scrollHeightClx: string
|
|
24
|
-
}> = observer(({
|
|
25
|
-
icon,
|
|
26
|
-
clx='',
|
|
27
|
-
panelClx='',
|
|
28
|
-
triggerClx='',
|
|
29
|
-
scrollAfter,
|
|
30
|
-
scrollHeightClx
|
|
31
|
-
}) => {
|
|
32
|
-
const cmmc = useCommerce()
|
|
33
|
-
return (
|
|
34
|
-
<Accordion type="single" collapsible className={clx}>
|
|
35
|
-
<AccordionItem value="cart" className='w-full border-b-0'>
|
|
36
|
-
<AccordionTrigger className={'!no-underline group flex justify-between '} headerClx={ triggerClx}>
|
|
37
|
-
<div className='flex gap-0 items-center'>
|
|
38
|
-
{icon}
|
|
39
|
-
<h5 className='text-sm sm:text-xl grow'>
|
|
40
|
-
<span className='group-data-[state=open]:hidden' >Order Total:</span>
|
|
41
|
-
<span className='group-data-[state=closed]:hidden' >Your Order</span>
|
|
42
|
-
</h5>
|
|
43
|
-
</div>
|
|
44
|
-
<div className='flex gap-1 items-center'>
|
|
45
|
-
<h5 className='text-sm sm:text-xl grow truncate'>{formatCurrencyValue(cmmc.promoAppliedCartTotal)}</h5>
|
|
46
|
-
<ChevronRight className="h-5 w-5 -mr-2 shrink-0 transition-transform duration-200 group-data-[state=open]:rotate-90" />
|
|
47
|
-
</div>
|
|
48
|
-
</AccordionTrigger>
|
|
49
|
-
<AccordionContent className='data-[state=open]:mb-4'>
|
|
50
|
-
<CartPanel
|
|
51
|
-
className={cn('w-full', panelClx)}
|
|
52
|
-
scrollAfter={scrollAfter}
|
|
53
|
-
scrollHeightClx={scrollHeightClx}
|
|
54
|
-
listClx='mt-0'
|
|
55
|
-
itemClx='mt-0.5 mb-0'
|
|
56
|
-
totalClx='sticky px-1 pr-2 border-t -bottom-[1px] bg-background'
|
|
57
|
-
showShipping
|
|
58
|
-
showPromoCode
|
|
59
|
-
/>
|
|
60
|
-
</AccordionContent>
|
|
61
|
-
</AccordionItem>
|
|
62
|
-
</Accordion>
|
|
63
|
-
)
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
export default CartAccordian
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { observer } from 'mobx-react-lite'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
useCommerce,
|
|
7
|
-
CarouselItemSelector,
|
|
8
|
-
type CarouselItemSelectorPropsExt
|
|
9
|
-
} from '@hanzo/commerce'
|
|
10
|
-
|
|
11
|
-
const DesktopBagCarousel: React.FC<{
|
|
12
|
-
constrainTo: {w: number, h: number}
|
|
13
|
-
className?: string
|
|
14
|
-
}> = observer(({
|
|
15
|
-
constrainTo,
|
|
16
|
-
className=''
|
|
17
|
-
|
|
18
|
-
}) => {
|
|
19
|
-
const cmmc = useCommerce()
|
|
20
|
-
return (
|
|
21
|
-
<CarouselItemSelector
|
|
22
|
-
items={cmmc.cartItems}
|
|
23
|
-
selectedItemRef={cmmc}
|
|
24
|
-
scrollable={false} // ignored
|
|
25
|
-
selectSku={cmmc.setCurrentItem.bind(cmmc)}
|
|
26
|
-
clx={className}
|
|
27
|
-
ext={{
|
|
28
|
-
options: {loop: true},
|
|
29
|
-
constrainTo,
|
|
30
|
-
imageOnly: true
|
|
31
|
-
} satisfies CarouselItemSelectorPropsExt}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
export default DesktopBagCarousel
|