4
0
forked from crowetic/commerce

Modifications

This commit is contained in:
Belen Curcio 2020-10-26 09:27:21 -03:00
parent 35355e4b2b
commit eec2df18b3
36 changed files with 74 additions and 46 deletions

View File

@ -1,6 +1,6 @@
import { FC, useEffect, useState, useCallback } from 'react' import { FC, useEffect, useState, useCallback } from 'react'
import { validate } from 'email-validator' import { validate } from 'email-validator'
import { Info } from '@components/icon' import { Info } from'@components/icons'
import { useUI } from '@components/ui/context' import { useUI } from '@components/ui/context'
import { Logo, Button, Input } from '@components/ui' import { Logo, Button, Input } from '@components/ui'
import useSignup from '@lib/bigcommerce/use-signup' import useSignup from '@lib/bigcommerce/use-signup'

View File

@ -60,11 +60,19 @@ const LoginView: FC<Props> = () => {
</div> </div>
<div className="flex flex-col space-y-3"> <div className="flex flex-col space-y-3">
{message && ( {message && (
<div className="text-red border border-red p-3">{message}</div> <div className="text-red border border-red p-3">
{message}. Did you {` `}
<a
className="text-accent-9 inline font-bold hover:underline cursor-pointer"
onClick={() => setModalView('FORGOT_VIEW')}
>
forgot your password?
</a>
</div>
)} )}
<Input placeholder="Email" onChange={setEmail} /> <Input placeholder="Email" onChange={setEmail} />
<Input placeholder="Password" onChange={setPassword} /> <Input placeholder="Password" onChange={setPassword} />
<Button <Button
variant="slim" variant="slim"
onClick={() => handleLogin()} onClick={() => handleLogin()}
@ -73,7 +81,7 @@ const LoginView: FC<Props> = () => {
> >
Log In Log In
</Button> </Button>
<span className="pt-3 text-center text-sm"> <div className="pt-1 text-center text-sm">
<span className="text-accents-7">Don't have an account?</span> <span className="text-accents-7">Don't have an account?</span>
{` `} {` `}
<a <a
@ -82,7 +90,7 @@ const LoginView: FC<Props> = () => {
> >
Sign Up Sign Up
</a> </a>
</span> </div>
</div> </div>
</div> </div>
) )

View File

@ -1,6 +1,6 @@
import { FC, useEffect, useState, useCallback } from 'react' import { FC, useEffect, useState, useCallback } from 'react'
import { validate } from 'email-validator' import { validate } from 'email-validator'
import { Info } from '@components/icon' import { Info } from '@components/icons'
import { useUI } from '@components/ui/context' import { useUI } from '@components/ui/context'
import { Logo, Button, Input } from '@components/ui' import { Logo, Button, Input } from '@components/ui'
import useSignup from '@lib/bigcommerce/use-signup' import useSignup from '@lib/bigcommerce/use-signup'
@ -59,7 +59,7 @@ const SignUpView: FC<Props> = () => {
}, [handleValidation]) }, [handleValidation])
return ( return (
<div className="w-80 flex flex-col justify-between p-3"> <div className="w-96 flex flex-col justify-between p-3">
<div className="flex justify-center pb-12 "> <div className="flex justify-center pb-12 ">
<Logo width="64px" height="64px" /> <Logo width="64px" height="64px" />
</div> </div>
@ -72,13 +72,13 @@ const SignUpView: FC<Props> = () => {
<Input placeholder="Email" onChange={setEmail} /> <Input placeholder="Email" onChange={setEmail} />
<Input placeholder="Password" onChange={setPassword} /> <Input placeholder="Password" onChange={setPassword} />
<span className="text-accents-8"> <span className="text-accents-8">
<Info <span className="inline-block align-middle ">
width="20" <Info width="15" height="15" />
height="20" </span>{' '}
className="inline-block mr-1 text-accents-8" <span className="leading-6 text-sm">
/> <strong>Info</strong>: Passwords must be longer than 7 chars and
<strong>Info</strong>: Password must be longer than 7 chars and include numbers.{' '}
include numbers. </span>
</span> </span>
<div className="pt-2 w-full flex flex-col"> <div className="pt-2 w-full flex flex-col">
<Button <Button
@ -91,7 +91,7 @@ const SignUpView: FC<Props> = () => {
</Button> </Button>
</div> </div>
<span className="pt-3 text-center text-sm"> <span className="pt-1 text-center text-sm">
<span className="text-accents-7">Do you have an account?</span> <span className="text-accents-7">Do you have an account?</span>
{` `} {` `}
<a <a

View File

@ -1,2 +1,3 @@
export { default as LoginView } from './LoginView' export { default as LoginView } from './LoginView'
export { default as SignUpView } from './SignUpView' export { default as SignUpView } from './SignUpView'
export { default as ForgotPassword } from './ForgotPassword'

View File

@ -2,7 +2,7 @@ import s from './CartItem.module.css'
import Image from 'next/image' import Image from 'next/image'
import Link from 'next/link' import Link from 'next/link'
import { ChangeEvent, useEffect, useState } from 'react' import { ChangeEvent, useEffect, useState } from 'react'
import { Trash, Plus, Minus } from '@components/icon' import { Trash, Plus, Minus } from '@components/icons'
import usePrice from '@lib/bigcommerce/use-price' import usePrice from '@lib/bigcommerce/use-price'
import useUpdateItem from '@lib/bigcommerce/cart/use-update-item' import useUpdateItem from '@lib/bigcommerce/cart/use-update-item'
import useRemoveItem from '@lib/bigcommerce/cart/use-remove-item' import useRemoveItem from '@lib/bigcommerce/cart/use-remove-item'

View File

@ -2,7 +2,7 @@ import { FC } from 'react'
import cn from 'classnames' import cn from 'classnames'
import { UserNav } from '@components/core' import { UserNav } from '@components/core'
import { Button } from '@components/ui' import { Button } from '@components/ui'
import { ArrowLeft, Bag, Cross, Check } from '@components/icon' import { ArrowLeft, Bag, Cross, Check } from '@components/icons'
import { useUI } from '@components/ui/context' import { useUI } from '@components/ui/context'
import useCart from '@lib/bigcommerce/cart/use-cart' import useCart from '@lib/bigcommerce/cart/use-cart'
import usePrice from '@lib/bigcommerce/use-price' import usePrice from '@lib/bigcommerce/use-price'

View File

@ -4,7 +4,7 @@ import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import type { Page } from '@lib/bigcommerce/api/operations/get-all-pages' import type { Page } from '@lib/bigcommerce/api/operations/get-all-pages'
import getSlug from '@utils/get-slug' import getSlug from '@utils/get-slug'
import { Github } from '@components/icon' import { Github } from '@components/icons'
import { Logo, Container } from '@components/ui' import { Logo, Container } from '@components/ui'
import { I18nWidget } from '@components/core' import { I18nWidget } from '@components/core'

View File

@ -3,7 +3,7 @@ import cn from 'classnames'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import Link from 'next/link' import Link from 'next/link'
import { Menu } from '@headlessui/react' import { Menu } from '@headlessui/react'
import { DoubleChevron } from '@components/icon' import { DoubleChevron } from '@components/icons'
import s from './I18nWidget.module.css' import s from './I18nWidget.module.css'
const LOCALES_MAP: Record<string, string> = { const LOCALES_MAP: Record<string, string> = {

View File

@ -6,7 +6,7 @@ import { CommerceProvider } from '@lib/bigcommerce'
import { CartSidebarView } from '@components/cart' import { CartSidebarView } from '@components/cart'
import { Container, Sidebar, Button, Modal, Toast } from '@components/ui' import { Container, Sidebar, Button, Modal, Toast } from '@components/ui'
import { Navbar, Featurebar, Footer } from '@components/core' import { Navbar, Featurebar, Footer } from '@components/core'
import { LoginView, SignUpView } from '@components/auth' import { LoginView, SignUpView, ForgotPassword } from '@components/auth'
import { useUI } from '@components/ui/context' import { useUI } from '@components/ui/context'
import { usePreventScroll } from '@react-aria/overlays' import { usePreventScroll } from '@react-aria/overlays'
import s from './Layout.module.css' import s from './Layout.module.css'
@ -74,6 +74,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
<Modal open={displayModal} onClose={closeModal}> <Modal open={displayModal} onClose={closeModal}>
{modalView === 'LOGIN_VIEW' && <LoginView />} {modalView === 'LOGIN_VIEW' && <LoginView />}
{modalView === 'SIGNUP_VIEW' && <SignUpView />} {modalView === 'SIGNUP_VIEW' && <SignUpView />}
{modalView === 'FORGOT_VIEW' && <ForgotPassword />}
</Modal> </Modal>
<Featurebar <Featurebar
title="This site uses cookies to improve your experience." title="This site uses cookies to improve your experience."

View File

@ -1,6 +1,6 @@
import React, { FC } from 'react' import React, { FC } from 'react'
import { Switch } from '@headlessui/react' import { Switch } from '@headlessui/react'
import { Moon, Sun } from '@components/icon' import { Moon, Sun } from '@components/icons'
interface Props { interface Props {
className?: string className?: string
checked: boolean checked: boolean

View File

@ -3,7 +3,7 @@ import Link from 'next/link'
import { useTheme } from 'next-themes' import { useTheme } from 'next-themes'
import cn from 'classnames' import cn from 'classnames'
import s from './DropdownMenu.module.css' import s from './DropdownMenu.module.css'
import { Moon, Sun } from '@components/icon' import { Moon, Sun } from '@components/icons'
import { Menu, Transition } from '@headlessui/react' import { Menu, Transition } from '@headlessui/react'
import useLogout from '@lib/bigcommerce/use-logout' import useLogout from '@lib/bigcommerce/use-logout'
interface DropdownMenuProps { interface DropdownMenuProps {

View File

@ -2,7 +2,7 @@ import Link from 'next/link'
import cn from 'classnames' import cn from 'classnames'
import s from './UserNav.module.css' import s from './UserNav.module.css'
import { FC } from 'react' import { FC } from 'react'
import { Heart, Bag } from '@components/icon' import { Heart, Bag } from '@components/icons'
import { Avatar } from '@components/core' import { Avatar } from '@components/core'
import { useUI } from '@components/ui/context' import { useUI } from '@components/ui/context'
import { LoginView } from '@components/auth' import { LoginView } from '@components/auth'

View File

@ -1,14 +0,0 @@
const Cross = ({ ...props }) => {
return (
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" {...props}>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
)
}
export default Cross

View File

@ -0,0 +1,21 @@
const Cross = ({ ...props }) => {
return (
<svg
viewBox="0 0 24 24"
width="24"
height="24"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
shape-rendering="geometricPrecision"
{...props}
>
<path d="M18 6L6 18" />
<path d="M6 6l12 12" />
</svg>
)
}
export default Cross

View File

@ -3,7 +3,7 @@ import cn from 'classnames'
import Link from 'next/link' import Link from 'next/link'
import type { ProductNode } from '@lib/bigcommerce/api/operations/get-all-products' import type { ProductNode } from '@lib/bigcommerce/api/operations/get-all-products'
import usePrice from '@lib/bigcommerce/use-price' import usePrice from '@lib/bigcommerce/use-price'
import { Heart } from '@components/icon' import { Heart } from '@components/icons'
import { EnhancedImage } from '@components/core' import { EnhancedImage } from '@components/core'
import s from './ProductCard.module.css' import s from './ProductCard.module.css'

View File

@ -4,7 +4,7 @@ import Image from 'next/image'
import { NextSeo } from 'next-seo' import { NextSeo } from 'next-seo'
import s from './ProductView.module.css' import s from './ProductView.module.css'
import { Heart } from '@components/icon' import { Heart } from '@components/icons'
import { useUI } from '@components/ui/context' import { useUI } from '@components/ui/context'
import { Swatch, ProductSlider } from '@components/product' import { Swatch, ProductSlider } from '@components/product'
import { Button, Container } from '@components/ui' import { Button, Container } from '@components/ui'

View File

@ -1,7 +1,7 @@
import cn from 'classnames' import cn from 'classnames'
import { FC } from 'react' import { FC } from 'react'
import s from './Swatch.module.css' import s from './Swatch.module.css'
import { Check } from '@components/icon' import { Check } from '@components/icons'
import Button, { ButtonProps } from '@components/ui/Button' import Button, { ButtonProps } from '@components/ui/Button'
import { isDark } from '@lib/colors' import { isDark } from '@lib/colors'
interface Props { interface Props {

View File

@ -1,6 +1,6 @@
import React, { FC } from 'react' import React, { FC } from 'react'
import { Container } from '@components/ui' import { Container } from '@components/ui'
import { RightArrow } from '@components/icon' import { RightArrow } from '@components/icons'
import s from './Hero.module.css' import s from './Hero.module.css'
import Link from 'next/link' import Link from 'next/link'
interface Props { interface Props {

View File

@ -5,11 +5,12 @@ import { useDialog } from '@react-aria/dialog'
import { FocusScope } from '@react-aria/focus' import { FocusScope } from '@react-aria/focus'
import { Transition } from '@headlessui/react' import { Transition } from '@headlessui/react'
import { useOverlay, useModal, OverlayContainer } from '@react-aria/overlays' import { useOverlay, useModal, OverlayContainer } from '@react-aria/overlays'
import { Cross } from '@components/icons'
interface Props { interface Props {
className?: string className?: string
children?: any children?: any
open?: boolean open?: boolean
onClose?: () => void onClose: () => void
} }
const Modal: FC<Props> = ({ const Modal: FC<Props> = ({
@ -26,7 +27,7 @@ const Modal: FC<Props> = ({
let { overlayProps } = useOverlay( let { overlayProps } = useOverlay(
{ {
isOpen: open, isOpen: open,
isDismissable: true, isDismissable: false,
onClose: onClose, onClose: onClose,
...props, ...props,
}, },
@ -53,6 +54,16 @@ const Modal: FC<Props> = ({
{...modalProps} {...modalProps}
ref={ref} ref={ref}
> >
<div className="h-7 flex items-center justify-end w-full">
<button
onClick={() => onClose()}
aria-label="Close panel"
className="hover:text-gray-500 transition ease-in-out duration-150 focus:outline-none"
>
<Cross className="h-6 w-6" />
</button>
</div>
{children} {children}
</div> </div>
</Transition.Child> </Transition.Child>

View File

@ -58,7 +58,7 @@ type Action =
view: 'SIGNUP_VIEW' view: 'SIGNUP_VIEW'
} }
type MODAL_VIEWS = 'SIGNUP_VIEW' | 'LOGIN_VIEW' type MODAL_VIEWS = 'SIGNUP_VIEW' | 'LOGIN_VIEW' | 'FORGOT_VIEW'
type ToastText = string type ToastText = string
export const UIContext = React.createContext<State | any>(initialState) export const UIContext = React.createContext<State | any>(initialState)

View File

@ -1,5 +1,5 @@
import { FC } from 'react' import { FC } from 'react'
import { Trash } from '@components/icon' import { Trash } from '@components/icons'
import s from './WishlistCard.module.css' import s from './WishlistCard.module.css'
interface Props { interface Props {

View File

@ -2,7 +2,7 @@ import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages' import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
import { Layout } from '@components/core' import { Layout } from '@components/core'
import { Button } from '@components/ui' import { Button } from '@components/ui'
import { Bag, Cross, Check } from '@components/icon' import { Bag, Cross, Check } from '@components/icons'
import useCart from '@lib/bigcommerce/cart/use-cart' import useCart from '@lib/bigcommerce/cart/use-cart'
import usePrice from '@lib/bigcommerce/use-price' import usePrice from '@lib/bigcommerce/use-price'
import { CartItem } from '@components/cart' import { CartItem } from '@components/cart'