diff --git a/package.json b/package.json index 46d0c8e..5e229e4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "axios": "^1.6.5", "clsx": "^2.1.0", "dotenv": "^16.3.1", - "js-cookie": "^3.0.5", "next": "^14.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -58,7 +57,6 @@ "@testing-library/jest-dom": "^6.2.0", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.5.1", - "@types/js-cookie": "^3.0.6", "@types/jsdom-global": "^3.0.6", "@types/node": "^20.11.5", "@types/react": "^18.2.48", diff --git a/src/app/checkout/primeira-etapa/layout.tsx b/src/app/checkout/primeira-etapa/layout.tsx deleted file mode 100644 index 484476c..0000000 --- a/src/app/checkout/primeira-etapa/layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { Metadata } from 'next' -import type { ReactNode } from 'react' - -export const metadata: Metadata = { - title: 'Etapa 1' -} - -const HomeLayout = ({ children }: { children: ReactNode }) => <>{children} - -export default HomeLayout diff --git a/src/app/checkout/primeira-etapa/page.tsx b/src/app/checkout/primeira-etapa/page.tsx deleted file mode 100644 index 8174834..0000000 --- a/src/app/checkout/primeira-etapa/page.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import axios from 'axios' - -import { TitleSection } from 'components/atoms' -import { Cart, Flavor, Steps } from 'components/molecules' - -import S from './styles.module.scss' - -const getPizzas = async () => { - const { data } = await axios.get( - 'https://raw.githubusercontent.com/everton-dgn/pizzaria_toffanetto/main/public/api/pizzas.json' - ) - - return { data: data[0] } -} - -const Etapa1 = async () => { - const { data } = await getPizzas() - - return ( - <> - - - -
- -
- - ) -} - -export default Etapa1 diff --git a/src/app/checkout/primeira-etapa/styles.module.scss b/src/app/checkout/primeira-etapa/styles.module.scss deleted file mode 100644 index ad73821..0000000 --- a/src/app/checkout/primeira-etapa/styles.module.scss +++ /dev/null @@ -1,10 +0,0 @@ -@use 'src/theme' as T; - -.container { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - margin-inline: auto; - padding: 0 2rem; -} diff --git a/src/app/checkout/quarta-etapa/layout.tsx b/src/app/checkout/quarta-etapa/layout.tsx deleted file mode 100644 index d64b349..0000000 --- a/src/app/checkout/quarta-etapa/layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { Metadata } from 'next' -import type { ReactNode } from 'react' - -export const metadata: Metadata = { - title: 'Etapa 4' -} - -const HomeLayout = ({ children }: { children: ReactNode }) => <>{children} - -export default HomeLayout diff --git a/src/app/checkout/quarta-etapa/page.tsx b/src/app/checkout/quarta-etapa/page.tsx deleted file mode 100644 index 1a2e6b1..0000000 --- a/src/app/checkout/quarta-etapa/page.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { useRouter } from 'next/navigation' - -import { Button, TitleSection } from 'components/atoms' -import { Cart, Steps } from 'components/molecules' -import { FormData } from 'components/organisms' - -import S from './styles.module.scss' - -const Etapa4 = () => { - const { push } = useRouter() - - return ( - <> - - - -
- -
-
-
- - ) -} - -export default Etapa4 diff --git a/src/app/checkout/quarta-etapa/styles.module.scss b/src/app/checkout/quarta-etapa/styles.module.scss deleted file mode 100644 index 42a16ae..0000000 --- a/src/app/checkout/quarta-etapa/styles.module.scss +++ /dev/null @@ -1,19 +0,0 @@ -@use 'src/theme' as T; - -.container { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - margin-inline: auto; - padding: 0 2rem; -} - -.wrapperBtn { - display: flex; - flex-direction: row; - width: 100%; - margin: 2rem 0 3rem 0; - flex-wrap: nowrap; - justify-content: space-between; -} diff --git a/src/app/checkout/segunda-etapa/layout.tsx b/src/app/checkout/segunda-etapa/layout.tsx deleted file mode 100644 index a2a0b14..0000000 --- a/src/app/checkout/segunda-etapa/layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { Metadata } from 'next' -import type { ReactNode } from 'react' - -export const metadata: Metadata = { - title: 'Etapa 2' -} - -const HomeLayout = ({ children }: { children: ReactNode }) => <>{children} - -export default HomeLayout diff --git a/src/app/checkout/segunda-etapa/page.tsx b/src/app/checkout/segunda-etapa/page.tsx deleted file mode 100644 index 6fecc76..0000000 --- a/src/app/checkout/segunda-etapa/page.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import axios from 'axios' -// import { readToken } from 'utils/HandleToken' - -import { TitleSection } from 'components/atoms' -import { Cart, Size, Steps } from 'components/molecules' - -import S from './styles.module.scss' - -const getPizzas = async () => { - const { data } = await axios.get( - 'https://raw.githubusercontent.com/everton-dgn/pizzaria_toffanetto/main/public/api/pizzas.json' - ) - - return { data: data[0] } -} - -const Etapa2 = async () => { - const { data } = await getPizzas() - - // if (!readToken('tokenPageStep2') && typeof window !== 'undefined') { - // return (window.location.href = '/') - // } - - return ( - <> - - - -
- -
- - ) -} - -export default Etapa2 diff --git a/src/app/checkout/segunda-etapa/styles.module.scss b/src/app/checkout/segunda-etapa/styles.module.scss deleted file mode 100644 index ad73821..0000000 --- a/src/app/checkout/segunda-etapa/styles.module.scss +++ /dev/null @@ -1,10 +0,0 @@ -@use 'src/theme' as T; - -.container { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - margin-inline: auto; - padding: 0 2rem; -} diff --git a/src/app/checkout/sucesso/layout.tsx b/src/app/checkout/sucesso/layout.tsx deleted file mode 100644 index 613edd5..0000000 --- a/src/app/checkout/sucesso/layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { Metadata } from 'next' -import type { ReactNode } from 'react' - -export const metadata: Metadata = { - title: 'Página de Sucesso' -} - -const HomeLayout = ({ children }: { children: ReactNode }) => <>{children} - -export default HomeLayout diff --git a/src/app/checkout/sucesso/page.tsx b/src/app/checkout/sucesso/page.tsx deleted file mode 100644 index 1e99bf2..0000000 --- a/src/app/checkout/sucesso/page.tsx +++ /dev/null @@ -1,204 +0,0 @@ -'use client' - -import { useRouter } from 'next/navigation' -import { useContext, useEffect } from 'react' - -import { AiOutlineWhatsApp as IconWhatsapp } from 'react-icons/ai' -import { getStorage } from 'utils/HandleSessionStorage' -import { removeAllTokens } from 'utils/HandleToken' - -import { Button, TitleSection } from 'components/atoms' -import { Cart, Steps } from 'components/molecules' - -import { useCart } from 'hooks/UseCart' -import { DataContext } from 'hooks/UseContext' - -import S from './styles.module.scss' - -const Success = () => { - const { push } = useRouter() - - const { - additionals, - setAdditionals, - cart, - setCart, - // @ts-expect-error - formData: { address, email, name, phone }, - setFormData, - flavor, - setFlavor, - size, - setSize - } = useContext(DataContext) - - // if (!readToken('tokenPageSuccess') && typeof window !== 'undefined') { - // return (window.location.href = '/') - // } - - // eslint-disable-next-line react-hooks/rules-of-hooks - useEffect(() => { - // @ts-expect-error - getStorage('flavor') && setFlavor(getStorage('flavor')) - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - // @ts-expect-error - getStorage('size') && setSize(getStorage('size')) - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - // @ts-expect-error - getStorage('cart') && setCart(getStorage('cart')) - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - // @ts-expect-error - getStorage('additionals') && setAdditionals(getStorage('additionals')) - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - // @ts-expect-error - getStorage('form') && setFormData(getStorage('form')) - }, [setAdditionals, setCart, setFlavor, setFormData, setSize]) - - const getPontuation = () => { - return flavor.find( - (el: { recommendationDay: boolean }) => el.recommendationDay - )?.points - } - - // @ts-expect-error - const arrayAdditionals = additionals.filter( - (el: { qtd: number }) => el.qtd > 0 - ) - - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - const form = address !== undefined ? Object.entries(address) : [] - - const flavorList = flavor - .map((el: { name: string }) => `• ${el.name}%0a`) - .join(',') - .replace(/,+/g, '') - - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - const formList = form.map(el => `%0a ${el[1]}`) - - const additionalsList = - arrayAdditionals.length !== 0 - ? '%0a*Adiconais:*%0a' + - arrayAdditionals - .map((el: { qtd: any; name: any }) => `• ${el.qtd} x ${el.name}%0a`) - .join(',') - .replace(/,+/g, '') - : '' - - const pontuationText = - getPontuation() > 0 - ? '• Sim! 😀. Você selecionou a recomendação do dia e acumulou ➕' + - `${getPontuation()} pontos para a próxima compra!` - : 'Não selecionada! 😐' - - const SendZap = () => { - // não exceder 2.083 caracteres na url! (valores atuais possíveis de serem gerados são menores que 1000) - window.location.href = - `https://api.whatsapp.com/send?phone=55${phone}&text=%0a` + - `*DADOS%20DO%20PEDIDO:*%0a%0a*Nome%20Completo:*%0a${name}%0a%0a` + - `*E-mail:*%0a${email}%0a%0a*Celular:*%0a${phone}%0a%0a` + - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `*Endereço:*${formList}.%0a%0a*Sabor(es):*%0a${flavorList}%0a` + - `*Tamanho:*%0a•%20${ - // @ts-expect-error - size.size - }%0a${additionalsList}%0a` + - `*Recomendação%20do%20dia:*%0a${pontuationText}%0a%0a` + - `*TOTAL:*%0a${useCart( - // @ts-expect-error - cart - )}%0a` - - // remove todos os tokens caso retorne para essa página após enviar o pedido - removeAllTokens() - - sessionStorage.clear() - } - - return ( - <> - - - -
-

Resumo do Pedido

-
-
-
-
-

Sabor(es):

-
    - {flavor.map((el: { name: string }) => ( -
  • {'• ' + el.name}
  • - ))} -
-
-

Tamanho:

-
  • - { - // @ts-expect-error - '• ' + size.size - } -
  • -
    - {arrayAdditionals.length !== 0 && ( - <> -

    Adiconais:

    -
      - {arrayAdditionals.map((el: any) => ( -
    • - • {el.qtd} x {el.name} -
    • - ))} -
    - - )} -
    -
    -

    Nome Completo:

    -

    {name}

    -
    -

    E-mail:

    -

    {email}

    -
    -

    Celular:

    -

    {phone}

    -
    -
    -

    Endereço

    - {form.map(el => ( -

    {el[1] as any}.

    - ))} -
    -
    -

    Recomendação do dia?

    - {getPontuation() > 0 ? ( -

    - • Sim! 😀. Você selecionou a recomendação do dia e acumulou - {` +${getPontuation()} `} - pontos para a próxima compra! -

    - ) : ( -

    • Não selecionada! 😐

    - )} -
    -
    - - -
    -
    -
    -
    -
    - - ) -} - -export default Success diff --git a/src/app/checkout/sucesso/styles.module.scss b/src/app/checkout/sucesso/styles.module.scss deleted file mode 100644 index 010cc52..0000000 --- a/src/app/checkout/sucesso/styles.module.scss +++ /dev/null @@ -1,169 +0,0 @@ -@use 'src/theme' as T; - -.container { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - margin-inline: auto; - padding: 0 2rem; -} - -.zap { - width: 20px; - min-width: 20px; - height: 20px; - min-height: 20px; -} - -.titleComponent { - color: T.$color-primary; - font-weight: 700; - font-size: T.$font-size-20; - margin-bottom: 3rem; - width: fit-content; - animation: - zoom 0.4s ease-in-out, - fade-in 0.2s linear; - - @include T.animation-zoom; - @include T.animation-fade-in; - - &::after { - content: ''; - display: block; - height: 0.5rem; - width: 30%; - background-color: T.$color-secondary; - margin-top: 0.5rem; - border-radius: 1rem; - } -} - -.card { - display: flex; - flex-direction: row; - flex-wrap: wrap; - padding: 3rem; - border-radius: 1rem; - margin-bottom: 2rem; - width: 100%; - box-shadow: - -0.6rem -0.6rem 1.6rem 0 T.$color-light, - 0.6rem 0.6rem 1.6rem 0 T.$color-box-shadow-dark; -} - -.cardContent { - width: 100%; - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: space-between; -} - -.containerSuccess { - display: flex; - flex-direction: row; - justify-content: space-between; -} - -.containerList { - display: flex; - flex-direction: column; - border: 0.2rem solid T.$color-secondary; - border-radius: 1rem; - padding: 1rem; - width: 100%; - margin-bottom: 2rem; - opacity: 0; - - &:nth-child(1) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 100ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(2) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 300ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(3) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 500ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(4) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 700ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - p, - li { - word-break: break-word; - } - - @include T.breakpoint-min('custom', 370px) { - width: calc(50% - 1.5rem); - } - - @include T.breakpoint-min('custom', 650px) { - width: calc(25% - 1.5rem); - } -} - -.btnSend { - display: flex; - align-items: center; - justify-content: center; - gap: T.$spacing-8; - font-size: T.$font-size-18; - text-transform: uppercase; - background-color: T.$color-secondary; - padding: 1rem 3rem; - margin: 1.5rem auto 0 auto; - font-weight: 700; - border-radius: 1rem; - transition: background-color 0.2s linear; - animation: - zoom 0.6s ease-in-out, - fade-in 0.2s linear forwards; - - @include T.animation-zoom; - @include T.animation-fade-in; -} - -.title { - font-weight: 700; - color: T.$color-primary; - font-size: T.$font-size-18; - margin-bottom: 0.3rem; -} - -.wrapperBtn { - display: flex; - flex-direction: row; - width: 100%; - margin: 2rem 0 3rem 0; - flex-wrap: nowrap; - justify-content: space-between; -} diff --git a/src/app/checkout/terceira-etapa/layout.tsx b/src/app/checkout/terceira-etapa/layout.tsx deleted file mode 100644 index a8f15c6..0000000 --- a/src/app/checkout/terceira-etapa/layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { Metadata } from 'next' -import type { ReactNode } from 'react' - -export const metadata: Metadata = { - title: 'Etapa 3' -} - -const HomeLayout = ({ children }: { children: ReactNode }) => <>{children} - -export default HomeLayout diff --git a/src/app/checkout/terceira-etapa/page.tsx b/src/app/checkout/terceira-etapa/page.tsx deleted file mode 100644 index ad133a9..0000000 --- a/src/app/checkout/terceira-etapa/page.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import axios from 'axios' - -import { Button, TitleSection } from 'components/atoms' -import { Additional, Cart, Steps } from 'components/molecules' - -import S from './styles.module.scss' - -const getPizzas = async () => { - const { data } = await axios.get( - 'https://raw.githubusercontent.com/everton-dgn/pizzaria_toffanetto/main/public/api/additionals.json' - ) - - return { data: data[0] } -} - -const Etapa3 = async () => { - const { data } = await getPizzas() - - return ( - <> - - - -
    - -
    -
    -
    - - ) -} - -export default Etapa3 diff --git a/src/app/checkout/terceira-etapa/styles.module.scss b/src/app/checkout/terceira-etapa/styles.module.scss deleted file mode 100644 index 87da8b8..0000000 --- a/src/app/checkout/terceira-etapa/styles.module.scss +++ /dev/null @@ -1,25 +0,0 @@ -@use 'src/theme' as T; - -.container { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - margin-inline: auto; - padding: 0 2rem; -} - -.wrapperBtn { - display: flex; - flex-direction: row; - flex-wrap: nowrap; - width: 100%; - justify-content: space-between; - margin: 2rem 0 3rem 0; -} - -.space { - width: 100%; - max-width: 2rem; - display: flex; -} diff --git a/src/app/error.tsx b/src/app/error.tsx index 312910d..db5edf4 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -4,8 +4,6 @@ import Image from 'next/image' import { useRouter } from 'next/navigation' import { useContext, useEffect } from 'react' -import { TitleSection } from 'components/atoms' - import { DataContext } from 'hooks/UseContext' import S from 'app/styles.module.scss' @@ -27,7 +25,7 @@ export const Error = ({ return ( <> - +

    Erro 404

    {hasNetwork ? ( diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx index 664aecf..98a93a8 100644 --- a/src/app/global-error.tsx +++ b/src/app/global-error.tsx @@ -6,8 +6,6 @@ import { useContext } from 'react' import quicksand from 'theme/fontFamily' -import { TitleSection } from 'components/atoms' - import { DataContext } from 'hooks/UseContext' import 'theme/reset.scss' @@ -44,7 +42,7 @@ const GlobalError = ({ error, reset }: ErrorProps) => { {/* */} {/*

    {error.message}

    */} - +

    Erro 404

    {hasNetwork ? ( diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx index 8a66ac5..80b4b10 100644 --- a/src/app/not-found.tsx +++ b/src/app/not-found.tsx @@ -4,8 +4,6 @@ import Image from 'next/image' import { useRouter } from 'next/navigation' import { useContext } from 'react' -import { TitleSection } from 'components/atoms' - import { DataContext } from 'hooks/UseContext' import S from 'app/styles.module.scss' @@ -16,7 +14,7 @@ const NotFound = () => { return ( <> - +

    Erro 404

    {hasNetwork ? ( diff --git a/src/components/atoms/TitleSection/index.tsx b/src/components/atoms/TitleSection/index.tsx deleted file mode 100644 index 5ef98fd..0000000 --- a/src/components/atoms/TitleSection/index.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import S from './styles.module.scss' - -interface TitleSectionProps { - title: string -} - -export const TitleSection = ({ title }: TitleSectionProps) => ( -
    -

    {title}

    -
    -) diff --git a/src/components/atoms/TitleSection/styles.module.scss b/src/components/atoms/TitleSection/styles.module.scss deleted file mode 100644 index 7156f76..0000000 --- a/src/components/atoms/TitleSection/styles.module.scss +++ /dev/null @@ -1,35 +0,0 @@ -@use 'src/theme' as T; - -.container { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - margin-inline: auto; - padding: 0 2rem; -} - -.titleSection { - width: fit-content; - margin: 4rem auto 2.3rem auto; - text-align: center; - font-weight: 700; - color: T.$color-primary; - font-size: T.$font-size-30; - animation: - zoom 0.4s ease-in-out, - fade-in 0.2s linear; - - @include T.animation-zoom; - @include T.animation-fade-in; - - &::after { - content: ''; - display: block; - height: 0.5rem; - width: 30%; - background-color: T.$color-secondary; - margin: 2rem auto 0 auto; - border-radius: 1rem; - } -} diff --git a/src/components/atoms/index.tsx b/src/components/atoms/index.tsx index 8affeb3..cfd725d 100644 --- a/src/components/atoms/index.tsx +++ b/src/components/atoms/index.tsx @@ -3,7 +3,6 @@ export { CartButton } from './CartButton' export { IconButton } from './IconButton' export { ContainerCardControlRender } from './ContainerCardControlRender' export { ErrorBoundary } from './ErrorBoundary' -export { TitleSection } from './TitleSection' export { Portal } from './Portal' export { Avatar } from './Avatar' export { Logo } from './Logo' diff --git a/src/components/molecules/Additional/index.tsx b/src/components/molecules/Additional/index.tsx deleted file mode 100644 index 63a71bc..0000000 --- a/src/components/molecules/Additional/index.tsx +++ /dev/null @@ -1,123 +0,0 @@ -// @ts-nocheck -'use client' - -import Image from 'next/image' -import { useContext, useEffect } from 'react' - -import { setStorage } from 'utils/HandleSessionStorage' - -import { useCart } from 'hooks/UseCart' -import { DataContext } from 'hooks/UseContext' - -import S from './styles.module.scss' - -import type { AdditionalProps } from './types' - -export const Additional = ({ data }: AdditionalProps) => { - const { hasNetwork, cart, setCart, additionals, setAdditionals } = - useContext(DataContext) - - useEffect(() => { - setAdditionals(data) - }, [data, setAdditionals]) - - useEffect(() => { - setStorage('additionals', additionals) - setStorage('cart', cart) - }, [additionals, cart]) - - const sumQtdAdditionals = (price: number) => { - // @ts-expect-error - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands - setCart(cart + price) - } - - const ConvertNumberToCurrency = (param: number) => useCart(param) - - const removeAdditional = (i: number) => { - const changeAdditionals = additionals - // @ts-expect-error - changeAdditionals[i].qtd = changeAdditionals[i].qtd - 1 - // @ts-expect-error - sumQtdAdditionals(-changeAdditionals[i].price) - } - - const addAdditional = (i: number) => { - const changeAdditionals = additionals - // @ts-expect-error - changeAdditionals[i].qtd = changeAdditionals[i].qtd + 1 - // @ts-expect-error - setAdditionals(changeAdditionals) - - // @ts-expect-error - sumQtdAdditionals(changeAdditionals[i].price) - } - - return ( - <> -

    Adicionais

    -
    - {data.map((el, i) => ( -
    -
    -
    -
    - {hasNetwork ? ( - {el.name} - ) : ( - {el.name} - )} -
    - -
    -

    {el.name}

    -
    -

    (200g / Porção)

    -
    -

    - {ConvertNumberToCurrency(el.price)} -

    -
    - -
    - - - - - -
    -
    -
    -
    - ))} -
    - - ) -} diff --git a/src/components/molecules/Additional/styles.module.scss b/src/components/molecules/Additional/styles.module.scss deleted file mode 100644 index a14df0a..0000000 --- a/src/components/molecules/Additional/styles.module.scss +++ /dev/null @@ -1,213 +0,0 @@ -@use 'src/theme' as T; - -.titleComponent { - color: T.$color-primary; - font-weight: 700; - font-size: T.$font-size-22; - margin-bottom: 2rem; - width: fit-content; - animation: - zoom 0.4s ease-in-out, - fade-in 0.2s linear; - - @include T.animation-zoom; - @include T.animation-fade-in; - - &::after { - content: ''; - display: block; - height: 0.5rem; - width: 30%; - background-color: T.$color-secondary; - margin-top: 0.5rem; - border-radius: 1rem; - } -} - -.containerMain { - display: flex; - flex-direction: row; - justify-content: space-between; - margin-top: 3rem; - flex-wrap: wrap; -} - -.card { - display: flex; - flex-direction: column; - padding: 2rem; - border-radius: 1rem; - margin-bottom: 2rem; - box-shadow: - -0.6rem -0.6rem 1.6rem 0 T.$color-light, - 0.6rem 0.6rem 1.6rem 0 T.$color-box-shadow-dark; - border: 0.2rem solid T.$color-bg-default; - transition: border-color 0.2s linear; - opacity: 0; - width: calc(50% - 1rem); - - &:nth-child(1) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 100ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(2) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 300ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(3) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 500ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(4) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 700ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:hover { - border: 0.2rem solid T.$color-primary; - } - - @include T.breakpoint-min('custom', 750px) { - width: calc(25% - 2rem); - } - - @include T.breakpoint-min('custom', 1300px) { - width: calc(25% - 3rem); - } -} - -.containerInfo { - display: flex; - flex-direction: column; - width: 100%; - justify-content: flex-start; - text-align: center; -} - -.contentInfo { - display: flex; - flex-direction: column; -} - -.title { - display: flex; - flex-direction: row; - font-weight: 700; - color: T.$color-primary; - font-size: T.$font-size-20; - text-transform: uppercase; - margin: 0.7rem 0; - justify-content: center; -} - -.subTitle { - font-size: T.$font-size-18; - font-weight: 500; - margin-bottom: 0.9rem; - margin-top: 0; -} - -.containerAdditional { - display: flex; - flex-direction: row; - justify-content: space-between; -} - -.box { - display: flex; - border: 0.2rem solid T.$color-secondary; - border-radius: 1rem; - padding: 1.5rem; - flex-direction: column; - width: 100%; -} - -.boxImg { - display: flex; - overflow: hidden; - border-radius: 1rem; - width: 100%; - height: 18rem; - position: relative; -} - -.image { - object-fit: cover; - object-position: center; -} - -.addItem { - display: flex; - flex-direction: row; - width: 100%; - justify-content: center; - margin-top: 1.2rem; - - input[type='number']::-webkit-inner-spin-button { - -webkit-appearance: none; - } - - input[type='number'] { - width: 100%; - max-width: 5rem; - -moz-appearance: textfield; - appearance: none; - -webkit-appearance: textfield; - background-color: T.$color-light T.$color-light; - border: 0.2rem solid T.$color-dark; - cursor: default; - border-radius: 0.5rem; - font-size: T.$font-size-20; - font-weight: 600; - text-align: center; - margin: 0 1rem; - color: T.$color-dark-grey; - } -} - -.btnCount { - display: block; - align-items: center; - justify-content: center; - background-color: T.$color-secondary; - font-weight: 700; - font-size: T.$font-size-20; - padding: 0; - border-radius: 0.6rem; - min-width: 4rem; - transition: background-color 0.2s linear; - - &:hover { - &:disabled { - background-color: T.$color-secondary; - } - } - - &:disabled { - opacity: 0.6; - cursor: not-allowed; - } -} diff --git a/src/components/molecules/Additional/types.ts b/src/components/molecules/Additional/types.ts deleted file mode 100644 index 4935bd6..0000000 --- a/src/components/molecules/Additional/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type AdditionalProps = { - data: [ - { - id: string - name: string - price: number - qtd: number - qtdMax: number - img: string - } - ] -} diff --git a/src/components/molecules/CardsSquare/index.tsx b/src/components/molecules/CardsSquare/index.tsx deleted file mode 100644 index 31df23b..0000000 --- a/src/components/molecules/CardsSquare/index.tsx +++ /dev/null @@ -1,66 +0,0 @@ -'use client' - -import Image from 'next/image' -import { useRouter } from 'next/navigation' -import { useContext } from 'react' - -import { Button } from 'components/atoms' - -import { DataContext } from 'hooks/UseContext' - -import S from './styles.module.scss' - -interface CardSquareProps { - data: any -} - -const CardsSquare = ({ data }: CardSquareProps) => { - const { push } = useRouter() - const { hasNetwork } = useContext(DataContext) - - return ( -
    - {data?.map((el: any) => ( -
    -
    - {hasNetwork ? ( - Imagem de uma pizza - ) : ( - Imagem de uma pizza - )} -
    -
    -

    PIZZA {el.name}

    - {el.recommendationDay && ( - *Recomendação do dia - )} -
    -

    Ingredientes:

    -

    {el.ingredients}

    -
    -
    -
    - ))} -
    - ) -} - -export default CardsSquare diff --git a/src/components/molecules/CardsSquare/styles.module.scss b/src/components/molecules/CardsSquare/styles.module.scss deleted file mode 100644 index 4e5c829..0000000 --- a/src/components/molecules/CardsSquare/styles.module.scss +++ /dev/null @@ -1,125 +0,0 @@ -@use 'src/theme' as T; - -.containerCards { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: space-between; - margin-bottom: 3rem; - margin-top: 3.5rem; - padding-left: 0; - padding-right: 0; -} - -.card { - display: flex; - flex-direction: column; - width: 100%; - padding: 2.5rem; - border-radius: T.$border-radius-16; - margin-bottom: 2.5rem; - box-shadow: - -0.6rem -0.6rem 1.6rem 0 T.$color-light, - 0.6rem 0.6rem 1.6rem 0 T.$color-box-shadow-dark; - border: 0.2rem solid T.$color-bg-default; - transition: border-color 0.2s linear; - - &:hover { - border: 0.2rem solid T.$color-secondary; - } - - @include T.breakpoint-min('custom', 400px) { - flex-direction: column; - width: calc(50% - 1.3rem); - margin-bottom: 2.5rem; - } - - @include T.breakpoint-min('custom', 750px) { - flex-direction: row; - width: calc(50% - 2rem); - margin-bottom: 3.5rem; - } -} - -.containerImg { - overflow: hidden; - border-radius: 1rem; - width: 100%; - min-width: 100%; - height: 100%; - min-height: 25rem; - max-height: 25rem; - position: relative; - - @include T.breakpoint-min('custom', 750px) { - min-width: 25rem; - } - - @include T.breakpoint-min('custom', 1280px) { - min-width: 30rem; - } -} - -.image { - object-fit: cover; - object-position: center; -} - -.containerInfo { - display: flex; - flex-direction: column; - width: 100%; - justify-content: space-between; - margin-top: 2rem; - height: 100%; - - @include T.breakpoint-min('custom', 750px) { - margin-left: 2rem; - margin-top: 0; - } -} - -.recommendation { - display: flex; - margin-top: 0.5rem; - color: T.$color-primary; - font-size: T.$font-size-14; -} - -.contentInfo { - display: flex; - flex-direction: column; -} - -.title { - font-weight: 700; - color: T.$color-primary; - font-size: T.$font-size-20; - text-transform: uppercase; - margin-top: 0; - margin-bottom: 0; - width: fit-content; - - &::after { - content: ''; - display: block; - height: 0.5rem; - width: 30%; - background-color: T.$color-secondary; - margin-top: 0.6rem; - border-radius: 1rem; - } -} - -.subTitle { - color: T.$color-dark; - font-size: T.$font-size-16; - font-weight: 600; - margin-bottom: 0.5rem; - margin-top: 0.5rem; -} - -.text { - font-size: T.$font-size-16; - margin-top: 0; -} diff --git a/src/components/molecules/Cart/index.tsx b/src/components/molecules/Cart/index.tsx deleted file mode 100644 index 495c863..0000000 --- a/src/components/molecules/Cart/index.tsx +++ /dev/null @@ -1,45 +0,0 @@ -// @ts-nocheck -'use client' - -import { useContext, useEffect } from 'react' - -import { getStorage } from 'utils/HandleSessionStorage' - -import { useCart } from 'hooks/UseCart' -import { DataContext } from 'hooks/UseContext' - -import S from './styles.module.scss' - -export const Cart = () => { - const { cart, setCart } = useContext(DataContext) - const convertCart = useCart(cart) - - useEffect(() => { - getStorage('cart') && setCart(getStorage('cart')) - }, [setCart]) - - return ( -
    -
    - {cart === 0 ? ( - Imagem de uma pizza - ) : ( - Imagem de uma pizza - )} -

    - Valor Total: {convertCart} -

    -
    -
    - ) -} diff --git a/src/components/molecules/Cart/styles.module.scss b/src/components/molecules/Cart/styles.module.scss deleted file mode 100644 index 10dd28a..0000000 --- a/src/components/molecules/Cart/styles.module.scss +++ /dev/null @@ -1,51 +0,0 @@ -@use 'src/theme' as T; - -.container { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - margin-inline: auto; - padding: 0 2rem; -} - -.containerCart { - margin-left: auto; - color: T.$color-dark; - margin-bottom: 0.2rem; - display: flex; - transform: translate3d(-200%, 0, 0); - animation: - move-in 0.4s ease-in-out forwards, - fade-in 0.2s linear; - - @include T.animation-move-in(0px, 0px, 0px); - @include T.animation-fade-in; - - & > div { - display: flex !important; - align-items: center; - } - - img { - transform: translateY(0.3rem); - } -} - -.cart { - text-align: right; - font-size: T.$font-size-22; - font-weight: 600; - color: T.$color-primary; - border: 0.2rem solid T.$color-secondary; - border-radius: 1rem; - padding: 1rem; - width: fit-content; - margin: 0 0 1.6rem 1rem; - - b { - color: T.$color-dark; - font-weight: 600; - margin-left: 0.5rem; - } -} diff --git a/src/components/molecules/Flavor/index.tsx b/src/components/molecules/Flavor/index.tsx deleted file mode 100644 index 8f35205..0000000 --- a/src/components/molecules/Flavor/index.tsx +++ /dev/null @@ -1,142 +0,0 @@ -'use client' - -import Image from 'next/image' -import { useRouter } from 'next/navigation' -import { useContext, useEffect } from 'react' - -import { clsx } from 'clsx' -import { getStorage, setStorage } from 'utils/HandleSessionStorage' - -import { Button } from 'components/atoms' - -import { DataContext } from 'hooks/UseContext' - -import S from './styles.module.scss' - -interface FlavorProps { - data: [ - { - id: string - img: string - ingredients: string - name: string - points: number - recommendationDay: boolean - } - ] -} - -export const Flavor = ({ data }: FlavorProps) => { - const { push } = useRouter() - const { flavor, setFlavor, hasNetwork } = useContext(DataContext) - - useEffect( - // @ts-expect-error - () => getStorage('flavor') && setFlavor(getStorage('flavor')), - [setFlavor] - ) - - useEffect(() => setStorage('flavor', flavor), [flavor]) - - const getFlavorById = (id: string, data: [{ id: string }]) => { - return data.find(el => el.id === id) - } - - const changeFlavorChecked = (id: string) => { - const currentFlavorClicked = getFlavorById(id, data) - - const verifyItemInFlavorClicked = getFlavorById(id, flavor) - - if (verifyItemInFlavorClicked) { - // @ts-expect-error - setFlavor(flavor.filter((el: { id: string }) => el.id !== id)) - } else { - // @ts-expect-error - setFlavor([...flavor, currentFlavorClicked]) - } - } - - return ( - <> -

    Sabores

    -
    - {data.map(el => { - const checked = !!getFlavorById(el.id, flavor) - return ( - - ) - })} - -
    -
    -
    - - ) -} diff --git a/src/components/molecules/Flavor/styles.module.scss b/src/components/molecules/Flavor/styles.module.scss deleted file mode 100644 index a1a86ed..0000000 --- a/src/components/molecules/Flavor/styles.module.scss +++ /dev/null @@ -1,227 +0,0 @@ -@use 'src/theme' as T; - -.titleComponent { - color: T.$color-primary; - font-weight: 700; - font-size: T.$font-size-22; - margin-bottom: 1.6rem; - width: fit-content; - animation: - zoom 0.4s ease-in-out forwards, - fade-in 0.2s linear forwards; - - @include T.animation-zoom; - @include T.animation-fade-in; - - &::after { - content: ''; - display: block; - height: 0.5rem; - width: 30%; - background-color: T.$color-secondary; - margin-top: 0.5rem; - border-radius: 1rem; - } -} - -.containerCard { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: space-between; - margin-top: 3rem; -} - -.card { - display: flex; - flex-direction: row; - padding: 1.5rem; - border-radius: 1rem; - margin-bottom: 2rem; - box-shadow: - -0.6rem -0.6rem 1.6rem 0 T.$color-light, - 0.6rem 0.6rem 1.6rem 0 T.$color-box-shadow-dark; - width: 100%; - cursor: pointer; - border-width: 2px; - border-style: solid; - transition: border-color 0.2s linear; - opacity: 0; - - &:nth-child(1) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 100ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(2) { - animation-delay: 300ms; - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(3) { - animation-delay: 500ms; - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(4) { - animation-delay: 700ms; - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:hover { - border: 0.2rem solid T.$color-secondary !important; - } - - @include T.breakpoint-min('custom', 540px) { - padding: 1.6rem 2rem; - } - - @include T.breakpoint-min('custom', 700px) { - width: calc(50% - 1rem); - } - - @include T.breakpoint-min('custom', 1300px) { - width: calc(50% - 2rem); - margin-bottom: 3rem; - } -} - -.containerImg { - overflow: hidden; - border-radius: 10px; - width: 90px; - min-width: 90px; - height: 90px; - position: relative; -} - -.image { - object-fit: cover; - object-position: center; -} - -.containerInfo { - display: flex; - flex-direction: column; - margin-left: 12px; - width: 100%; - justify-content: flex-start; - - em { - display: none; - color: T.$color-primary; - font-size: T.$font-size-12; - } - - @include T.breakpoint-min('custom', 540px) { - font-size: T.$font-size-12; - } -} - -.bonus { - border: 0.2rem solid T.$color-primary; - border-radius: 8px; - padding: 1px 5px 5px 5px; - - em { - display: flex; - } -} - -.contentInfo { - display: flex; - flex-direction: column; -} - -.title { - display: flex; - flex-wrap: wrap; - flex-direction: row; - font-weight: 700; - color: T.$color-primary; - font-size: T.$font-size-15; - text-transform: uppercase; - margin: 0; - align-items: baseline; - - b { - margin-right: 7px; - } - - @include T.breakpoint-min('custom', 540px) { - font-size: T.$font-size-18; - } -} - -.subTitle { - color: T.$color-dark; - font-size: T.$font-size-12; - font-weight: 600; - margin: 0; - - @include T.breakpoint-min('custom', 540px) { - font-size: T.$font-size-14; - } -} - -.text { - font-size: T.$font-size-13; - margin: 0; - line-height: 1.2; - - @include T.breakpoint-min('custom', 540px) { - font-size: T.$font-size-15; - line-height: 1.5; - } -} - -.containerCheckbox { - display: flex; - height: fit-content; - margin: auto 5px auto -10px; - - input { - width: 18px; - height: 18px; - cursor: pointer; - display: none; - } -} - -.hidden { - display: none; -} - -.wrapperBtn { - display: flex; - flex-direction: row; - flex-wrap: nowrap; - width: 100%; - justify-content: space-between; - margin: 2rem 0 3rem 0; -} - -.space { - width: 100%; - max-width: 2rem; -} diff --git a/src/components/molecules/Size/index.tsx b/src/components/molecules/Size/index.tsx deleted file mode 100644 index fc97f52..0000000 --- a/src/components/molecules/Size/index.tsx +++ /dev/null @@ -1,135 +0,0 @@ -'use client' - -import { useRouter } from 'next/navigation' -import { useContext, useEffect } from 'react' - -import { clsx } from 'clsx' -import { getStorage, setStorage } from 'utils/HandleSessionStorage' - -import { Button } from 'components/atoms' - -import { useCart } from 'hooks/UseCart' -import { DataContext } from 'hooks/UseContext' - -import S from './styles.module.scss' - -interface SizeProps { - sizes: [ - { - size: string - price: number - slices: number - } - ] -} - -export const Size = ({ sizes }: SizeProps) => { - const { push } = useRouter() - const { size, setSize, setCart } = useContext(DataContext) - // @ts-expect-error - useEffect(() => getStorage('size') && setSize(getStorage('size')), [setSize]) - - const addCart = (price: number) => { - // @ts-expect-error - setCart(price) - setStorage('cart', price) - } - - const handleSizeChecked = (price: number, currentSize: string) => { - const sizeAndPrice = { price, size: currentSize } - // @ts-expect-error - setSize(sizeAndPrice) - - setStorage('size', sizeAndPrice) - - addCart(price) - } - - const ConvertToPrice = (price: number) => useCart(price) - - return ( - <> -

    Tamanhos

    -
    - {sizes.map(el => ( - - ))} - -
    -
    -
    - - ) -} diff --git a/src/components/molecules/Size/styles.module.scss b/src/components/molecules/Size/styles.module.scss deleted file mode 100644 index 488a858..0000000 --- a/src/components/molecules/Size/styles.module.scss +++ /dev/null @@ -1,190 +0,0 @@ -@use 'src/theme' as T; - -.titleComponent { - color: T.$color-primary; - font-weight: 700; - font-size: T.$font-size-22; - margin-bottom: 3rem; - width: fit-content; - animation: - zoom 0.4s ease-in-out, - fade-in 0.2s linear; - - @include T.animation-zoom; - @include T.animation-fade-in; - - &::after { - content: ''; - display: block; - height: 0.5rem; - width: 30%; - background-color: T.$color-secondary; - margin-top: 0.5rem; - border-radius: 1rem; - } -} - -.containerSize { - display: flex; - flex-direction: row; - justify-content: space-between; - flex-wrap: wrap; -} - -.card { - display: flex; - flex-direction: column; - padding: 2rem; - border-radius: 1rem; - margin-bottom: 2.5rem; - box-shadow: - -0.6rem -0.6rem 1.6rem 0 T.$color-light, - 0.6rem 0.6rem 1.6rem 0 T.$color-box-shadow-dark; - width: calc(50% - 1rem); - cursor: pointer; - border-width: 2px; - border-style: solid; - transition: border-color 0.2s linear; - opacity: 0; - - &:nth-child(1) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 100ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(2) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 300ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(3) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 500ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:nth-child(4) { - animation: - zoom 0.4s ease-in-out, - fade-in 0.1s linear forwards; - animation-delay: 700ms; - - @include T.animation-zoom; - @include T.animation-fade-in; - } - - &:hover { - border: 0.2rem solid T.$color-primary; - } - - @include T.breakpoint-min('custom', 870px) { - width: calc(25% - 2rem); - } - - @include T.breakpoint-min('custom', 1300px) { - width: calc(25% - 3rem); - } -} - -.containerInfo { - display: flex; - flex-direction: column; - width: 100%; - justify-content: flex-start; -} - -.contentInfo { - display: flex; - flex-direction: column; - text-align: center; -} - -.title { - display: flex; - flex-direction: row; - font-weight: 700; - color: T.$color-primary; - font-size: T.$font-size-20; - text-transform: uppercase; - margin: 1rem 0 0 0; - justify-content: center; - text-align: center; -} - -.subTitle { - font-size: T.$font-size-17; - font-weight: 500; - margin-bottom: -0.5rem; - margin-top: 1rem; - display: flex; - align-items: center; - justify-content: center; - - img { - margin-right: 1rem; - } -} - -.containerRadio { - display: flex; - flex-direction: row; - justify-content: space-between; - height: 100%; -} - -.radioContent { - display: flex; - flex-direction: column; - border: 0.2rem solid T.$color-secondary; - border-radius: 1rem; - padding: 1.5rem 2rem; - width: 100%; -} - -.radioLabel { - margin: -0.5rem auto 0 auto; - - input { - width: 18px; - height: 18px; - cursor: pointer; - display: none; - } - - img { - object-fit: contain; - } -} - -.hidden { - display: none; -} - -.wrapperBtn { - display: flex; - flex-direction: row; - flex-wrap: nowrap; - width: 100%; - justify-content: space-between; - margin: 2rem 0 3rem 0; -} - -.space { - width: 100%; - max-width: 2rem; - display: flex; -} diff --git a/src/components/molecules/Steps/index.tsx b/src/components/molecules/Steps/index.tsx deleted file mode 100644 index c0f08f0..0000000 --- a/src/components/molecules/Steps/index.tsx +++ /dev/null @@ -1,82 +0,0 @@ -'use client' - -import { useRouter } from 'next/navigation' - -import { clsx } from 'clsx' -import { FaCheck as IconDone } from 'react-icons/fa' - -import S from './styles.module.scss' - -interface StepsProps { - activeStep: boolean[] -} - -export const Steps = ({ activeStep }: StepsProps) => { - const { push } = useRouter() - - const redirectRouter = (routerLink: string, step: number) => { - activeStep[step] && push(routerLink) - } - - return ( -
    -
    -
    -
    -
    -
    - -
    -
    - redirectRouter('/checkout/primeira-etapa', 0)} - > - {activeStep[4] ? : '1'} - -
    - -
    - redirectRouter('/checkout/segunda-etapa', 1)} - > - {activeStep[4] ? : '2'} - -
    - -
    - redirectRouter('/checkout/terceira-etapa', 2)} - > - {activeStep[4] ? : '3'} - -
    - -
    - redirectRouter('/checkout/quarta-etapa', 3)} - > - {activeStep[4] ? : '4'} - -
    -
    -
    - ) -} diff --git a/src/components/molecules/Steps/styles.module.scss b/src/components/molecules/Steps/styles.module.scss deleted file mode 100644 index 1985903..0000000 --- a/src/components/molecules/Steps/styles.module.scss +++ /dev/null @@ -1,72 +0,0 @@ -@use 'src/theme' as T; - -.checked { - color: T.$color-dark-grey; - width: 16px; - min-width: 16px; - height: 16px; - min-height: 16px; -} - -.containerSteps { - display: flex; - flex-direction: column; - width: 100%; - max-width: 130rem; - padding: 0 2rem; - margin: 20px auto 0; -} - -.containerLine { - display: flex; - flex-direction: row; - padding: 0 1.1rem; - justify-content: center; - margin-top: 2.1rem; - margin-bottom: -2.1rem; -} - -.lineStep { - flex: 1; - height: 0.4rem; - animation: zoom 0.3s ease-in; - - @include T.animation-zoom; -} - -.containerRounded { - display: flex; - flex-direction: row; - justify-content: space-between; - margin-bottom: 0.6rem; -} - -.step { - display: flex; - align-items: center; - justify-content: center; - font-size: T.$font-size-20; - font-weight: 700; - z-index: 10; - border-radius: 50%; - width: 4rem; - height: 4rem; - background-color: T.$color-box-shadow-dark; - cursor: not-allowed; - animation: zoom 0.3s ease-in; - - @include T.animation-zoom; -} - -.active { - background-color: T.$color-secondary; - cursor: pointer; - transition: - transform, - background-color, - 0.3s linear; - - &:hover { - transform: scale(1.1); - } -} diff --git a/src/components/molecules/index.tsx b/src/components/molecules/index.tsx index 314a76d..212d07c 100644 --- a/src/components/molecules/index.tsx +++ b/src/components/molecules/index.tsx @@ -2,14 +2,8 @@ export { PopupInstallPwa } from './PopupInstallPwa' export { default as Toast } from './Toast' export { default as Modal } from './Modal' export { CookieWarning } from './CookieWarning' -export { Additional } from './Additional' -export { default as CardsSquare } from './CardsSquare' -export { Cart } from './Cart' -export { Size } from './Size' export { Input } from './Input' export { Select } from './Select' -export { Flavor } from './Flavor' -export { Steps } from './Steps' export { CardProduct } from './CardProduct' export { QuantityCounterButton } from './QuantityCounterButton' export { Textarea } from './Textarea' diff --git a/src/hooks/UseCart.tsx b/src/hooks/UseCart.tsx deleted file mode 100644 index aa78728..0000000 --- a/src/hooks/UseCart.tsx +++ /dev/null @@ -1,10 +0,0 @@ -export const useCart = (price: number) => { - const convertToString = () => { - return price.toLocaleString('pt-br', { - style: 'currency', - currency: 'BRL' - }) - } - - return convertToString() -} diff --git a/src/hooks/UseContext.tsx b/src/hooks/UseContext.tsx deleted file mode 100644 index d77c81c..0000000 --- a/src/hooks/UseContext.tsx +++ /dev/null @@ -1,104 +0,0 @@ -'use client' - -import React, { - createContext, - type Dispatch, - type ReactNode, - useEffect, - useState -} from 'react' - -interface FormDataProvider { - name?: string - phone?: string - email?: string - address?: { - street: string - number: string - neighborhood: string - city: string - state: string - zipCode: string - } -} - -interface AdditionalProps { - id: string - name: string - price: number - qtd: number - qtdMax: number - img: string -} - -interface ChallengeContextData { - cart: number - setCart: Dispatch> - size: { price: number; size: string } - setSize: Dispatch> - formData: FormDataProvider - setFormData: Dispatch> - additionals: AdditionalProps[] - setAdditionals: Dispatch> - flavor: any - setFlavor: Dispatch> - hasNetwork: boolean - setHasNetwork: Dispatch> -} - -interface DataStorageProps { - children: ReactNode -} - -export const DataContext = createContext< - ChallengeContextData | Record ->({}) - -export const DataStorage = ({ children }: DataStorageProps) => { - const [flavor, setFlavor] = useState([]) - - const [additionals, setAdditionals] = useState([]) - - const [size, setSize] = useState({ price: 0, size: '' }) - - const [cart, setCart] = useState(0) - - const [formData, setFormData] = useState({}) - - const [hasNetwork, setHasNetwork] = useState(true) - - useEffect(() => { - window.addEventListener('load', () => { - setHasNetwork(navigator.onLine) - - window.addEventListener('online', () => setHasNetwork(true)) - - window.addEventListener('offline', () => setHasNetwork(false)) - }) - }, []) - - return ( - - {children} - - ) -} diff --git a/src/hooks/UseValidate.ts b/src/hooks/UseValidate.ts deleted file mode 100644 index cfd415b..0000000 --- a/src/hooks/UseValidate.ts +++ /dev/null @@ -1,45 +0,0 @@ -export {} - -// export const useValidate = () => { -// return Yup.object().shape({ -// name: Yup.string() -// // eslint-disable-next-line sonarjs/no-duplicate-string -// .min(2, 'Mínimo de 2 caracteres.') -// // eslint-disable-next-line sonarjs/no-duplicate-string -// .max(50, 'Máximo de 50 caracteres') -// // eslint-disable-next-line sonarjs/no-duplicate-string -// .required('Preenchimento obrigatório!'), -// email: Yup.string() -// .lowercase('Digite apenas letras minúsculas.') -// .strict() -// .min(8, 'Mínimo de 8 caracteres.') -// .email('Digite um E-mail válido!') -// .required('Preenchimento obrigatório!'), -// phone: Yup.string() -// .min(14, 'Mínimo de 10 caracteres.') -// .required('Preenchimento obrigatório!'), -// address: Yup.object().shape({ -// zipCode: Yup.string() -// .min(9, 'Mínimo de 8 caracteres.') -// .required('Preenchimento obrigatório!'), -// street: Yup.string() -// .min(2, 'Mínimo de 2 caracteres.') -// .required('Preenchimento obrigatório!'), -// number: Yup.string() -// .min(1, 'Mínimo de 1 caracteres.') -// .required('Preenchimento obrigatório!'), -// neighborhood: Yup.string() -// .min(2, 'Mínimo de 2 caracteres.') -// .max(50, 'Máximo de 50 caracteres') -// .required('Preenchimento obrigatório!'), -// city: Yup.string() -// .min(3, 'Mínimo de 3 caracteres.') -// .max(50, 'Máximo de 50 caracteres') -// .required('Preenchimento obrigatório!'), -// state: Yup.string() -// .min(2, 'Opção inválida.') -// .max(2, 'Opção inválida.') -// .required('Preenchimento obrigatório!') -// }) -// }) -// } diff --git a/src/hooks/index.tsx b/src/hooks/index.tsx index cba7b55..fa813ba 100644 --- a/src/hooks/index.tsx +++ b/src/hooks/index.tsx @@ -1,3 +1,4 @@ export { useToast } from './useToast' export { useAnimationRender } from './useAnimationRender' export { useToggleScrollbar } from './useToggleScrollbar' +export { useLazyLoadWithIntersectionObserver } from './useLazyLoadWithIntersectionObserver' diff --git a/src/hooks/useLazyLoadWithIntersectionObserver.ts b/src/hooks/useLazyLoadWithIntersectionObserver/index.ts similarity index 100% rename from src/hooks/useLazyLoadWithIntersectionObserver.ts rename to src/hooks/useLazyLoadWithIntersectionObserver/index.ts diff --git a/src/utils/HandleSessionStorage.ts b/src/utils/HandleSessionStorage.ts deleted file mode 100644 index b6c3fd2..0000000 --- a/src/utils/HandleSessionStorage.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const setStorage = (key: string, value: any) => { - sessionStorage.setItem(key, JSON.stringify(value)) -} - -export const getStorage = (key: string) => { - const verify = sessionStorage.getItem(key) || undefined - - if (verify) { - return JSON.parse(verify) - } -} diff --git a/src/utils/HandleToken.ts b/src/utils/HandleToken.ts deleted file mode 100644 index 5c39eca..0000000 --- a/src/utils/HandleToken.ts +++ /dev/null @@ -1,26 +0,0 @@ -import Cookies from 'js-cookie' - -export const writeToken = (name: string, value: string) => { - // token expira em 1h - const timeMinutesExpired = new Date(new Date().getTime() + 60 * 60 * 1000) - - return Cookies.set(name, value, { - expires: timeMinutesExpired - }) -} - -export const readToken = (name: string) => { - return Cookies.get(name) -} - -export const removeAllTokens = () => { - const listTokens = [ - 'tokenPageStep2', - 'tokenPageStep3', - 'tokenPageStep4', - 'tokenPageSuccess', - 'tokenReturnHome' - ] - - listTokens.forEach(el => Cookies.remove(el)) -} diff --git a/yarn.lock b/yarn.lock index d79f133..f5242e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1956,11 +1956,6 @@ resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== -"@types/js-cookie@^3.0.6": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-3.0.6.tgz#a04ca19e877687bd449f5ad37d33b104b71fdf95" - integrity sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ== - "@types/jsdom-global@^3.0.6": version "3.0.7" resolved "https://registry.yarnpkg.com/@types/jsdom-global/-/jsdom-global-3.0.7.tgz#4ffb034a54c7b2d4095cd8cd447f9e93bda9ed21" @@ -5379,11 +5374,6 @@ jiti@^1.19.1: resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.0.tgz#7c97f8fe045724e136a397f7340475244156105d" integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q== -js-cookie@^3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.5.tgz#0b7e2fd0c01552c58ba86e0841f94dc2557dcdbc" - integrity sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"