forked from crowetic/commerce
Merge branch 'master' of https://github.com/okbel/e-comm-example
This commit is contained in:
commit
5962657b7d
@ -59,7 +59,7 @@ const ForgotPassword: FC<Props> = () => {
|
|||||||
<div className="text-red border border-red p-3">{message}</div>
|
<div className="text-red border border-red p-3">{message}</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Input placeholder="Email" onChange={setEmail} />
|
<Input placeholder="Email" onChange={setEmail} type="email" />
|
||||||
<div className="pt-2 w-full flex flex-col">
|
<div className="pt-2 w-full flex flex-col">
|
||||||
<Button
|
<Button
|
||||||
variant="slim"
|
variant="slim"
|
||||||
|
@ -20,6 +20,7 @@ const Input: React.FC<Props> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<label>
|
||||||
<input
|
<input
|
||||||
className={rootClassName}
|
className={rootClassName}
|
||||||
onChange={handleOnChange}
|
onChange={handleOnChange}
|
||||||
@ -29,6 +30,7 @@ const Input: React.FC<Props> = (props) => {
|
|||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
|
</label>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { FC } from 'react'
|
import React, { FC, useMemo } from 'react'
|
||||||
import { ThemeProvider } from 'next-themes'
|
import { ThemeProvider } from 'next-themes'
|
||||||
import { SSRProvider, OverlayProvider } from 'react-aria'
|
import { SSRProvider, OverlayProvider } from 'react-aria'
|
||||||
|
|
||||||
@ -144,7 +144,8 @@ export const UIProvider: FC = (props) => {
|
|||||||
const setModalView = (view: MODAL_VIEWS) =>
|
const setModalView = (view: MODAL_VIEWS) =>
|
||||||
dispatch({ type: 'SET_MODAL_VIEW', view })
|
dispatch({ type: 'SET_MODAL_VIEW', view })
|
||||||
|
|
||||||
const value = {
|
const value = useMemo(
|
||||||
|
() => ({
|
||||||
...state,
|
...state,
|
||||||
openSidebar,
|
openSidebar,
|
||||||
closeSidebar,
|
closeSidebar,
|
||||||
@ -155,7 +156,9 @@ export const UIProvider: FC = (props) => {
|
|||||||
setModalView,
|
setModalView,
|
||||||
openToast,
|
openToast,
|
||||||
closeToast,
|
closeToast,
|
||||||
}
|
}),
|
||||||
|
[state]
|
||||||
|
)
|
||||||
|
|
||||||
return <UIContext.Provider value={value} {...props} />
|
return <UIContext.Provider value={value} {...props} />
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,10 @@ export default function Home({
|
|||||||
// products, then fill them with products from the products list, this
|
// products, then fill them with products from the products list, this
|
||||||
// is useful for new commerce sites that don't have a lot of products
|
// is useful for new commerce sites that don't have a lot of products
|
||||||
return {
|
return {
|
||||||
featured: rangeMap(
|
featured: rangeMap(6, (i) => featuredProducts[i] ?? products.shift())
|
||||||
6,
|
.filter(nonNullable)
|
||||||
(i) => featuredProducts[i] ?? products.shift()
|
.sort((a, b) => a.node.prices.price.value - b.node.prices.price.value)
|
||||||
).filter(nonNullable),
|
.reverse(),
|
||||||
bestSelling: rangeMap(
|
bestSelling: rangeMap(
|
||||||
6,
|
6,
|
||||||
(i) => bestSellingProducts[i] ?? products.shift()
|
(i) => bestSellingProducts[i] ?? products.shift()
|
||||||
@ -86,7 +86,7 @@ export default function Home({
|
|||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Marquee variant="secondary">
|
<Marquee variant="secondary">
|
||||||
{bestSelling.slice(0, 3).map(({ node }) => (
|
{bestSelling.slice(3, 6).map(({ node }) => (
|
||||||
<ProductCard
|
<ProductCard
|
||||||
key={node.path}
|
key={node.path}
|
||||||
product={node}
|
product={node}
|
||||||
@ -118,7 +118,7 @@ export default function Home({
|
|||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Marquee>
|
<Marquee>
|
||||||
{bestSelling.slice(3, 6).map(({ node }) => (
|
{bestSelling.slice(0, 3).map(({ node }) => (
|
||||||
<ProductCard
|
<ProductCard
|
||||||
key={node.path}
|
key={node.path}
|
||||||
product={node}
|
product={node}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user