Skip to content

Commit

Permalink
Merge pull request #26 from AllanOliveiraM/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
AllanOliveiraM authored Oct 3, 2021
2 parents 05c3637 + 4afeae7 commit 4fc3ba4
Show file tree
Hide file tree
Showing 41 changed files with 2,244 additions and 1,842 deletions.
6 changes: 1 addition & 5 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const path = require('path')

const withPlugins = require('next-compose-plugins')

const withMDX = require('@next/mdx')({ extension: /\.mdx?$/ })
const withReactSvg = require('next-react-svg')

const plugins = [withMDX, withReactSvg]
const plugins = [withMDX]

const nextConfig = {
reactStrictMode: true,
poweredByHeader: false,
pageExtensions: ['tsx', 'mdx'],
include: [path.resolve(__dirname, 'src/assets')],
i18n: {
locales: ['en', 'pt'],
defaultLocale: 'pt',
Expand Down
78 changes: 39 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,81 +21,81 @@
"build:storybook": "build-storybook"
},
"dependencies": {
"@hookform/resolvers": "^2.8.0",
"@hookform/resolvers": "^2.8.1",
"@mdx-js/loader": "^1.6.22",
"@next/mdx": "^11.1.0",
"@sentry/nextjs": "^6.11.0",
"@xstyled/styled-components": "^3.0.3",
"@xstyled/system": "^3.0.2",
"axios": "^0.21.1",
"@next/mdx": "^11.1.2",
"@sentry/nextjs": "^6.13.2",
"@xstyled/styled-components": "^3.1.0",
"@xstyled/system": "^3.1.0",
"axios": "^0.22.0",
"lodash": "^4.17.21",
"next": "11.1.0",
"next": "11.1.2",
"next-compose-plugins": "^2.2.1",
"next-react-svg": "^1.1.3",
"nookies": "^2.5.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "^7.12.2",
"sass": "^1.38.0",
"react-hook-form": "^7.17.0",
"sass": "^1.42.1",
"scheduler": "^0.20.2",
"styled-components": "^5.3.0",
"swr": "^0.5.6",
"use-context-selector": "^1.3.7",
"sharp": "^0.29.1",
"styled-components": "^5.3.1",
"swr": "^1.0.1",
"use-context-selector": "^1.3.9",
"yup": "^0.32.9"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/core": "^7.15.5",
"@babel/plugin-proposal-do-expressions": "^7.14.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/plugin-proposal-pipeline-operator": "^7.15.0",
"@babel/plugin-proposal-throw-expressions": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@commitlint/cli": "^13.2.0",
"@commitlint/config-conventional": "^13.2.0",
"@hookydev/babel-plugin-styled-components": "^1.10.7-1",
"@sentry/types": "^6.11.0",
"@storybook/addon-actions": "^6.3.7",
"@storybook/addon-essentials": "^6.3.7",
"@storybook/addon-links": "^6.3.7",
"@storybook/react": "^6.3.7",
"@sentry/types": "^6.13.2",
"@storybook/addon-actions": "^6.3.9",
"@storybook/addon-essentials": "^6.3.9",
"@storybook/addon-links": "^6.3.9",
"@storybook/react": "^6.3.9",
"@types/cookie": "^0.4.1",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.1",
"@types/react": "^17.0.19",
"@types/styled-components": "^5.1.12",
"@types/jest": "^27.0.2",
"@types/node": "^16.10.2",
"@types/react": "^17.0.26",
"@types/styled-components": "^5.1.14",
"@types/yup": "^0.29.13",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"babel-jest": "^27.0.6",
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
"babel-jest": "^27.2.4",
"babel-loader": "^8.2.2",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"commitlint": "^13.1.0",
"concurrently": "^6.2.1",
"commitlint": "^13.2.0",
"concurrently": "^6.3.0",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^13.0.0",
"eslint-config-next": "^11.1.0",
"eslint-config-airbnb-typescript": "^14.0.0",
"eslint-config-next": "^11.1.2",
"eslint-config-prettier": "^8.1.0",
"eslint-import-resolver-babel-module": "^5.2.0",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-import-helpers": "^1.1.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^7.0.1",
"jest": "^27.0.6",
"husky": "^7.0.2",
"jest": "^27.2.4",
"lint-staged": "^11.1.2",
"prettier": "^2.3.1",
"prettier": "^2.4.1",
"stylelint": "^13.13.1",
"stylelint-config-recommended": "^5.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"typescript": "^4.3.5"
"typescript": "^4.4.3"
},
"config": {
"commitizen": {
Expand Down
Empty file removed src/assets/.gitkeep
Empty file.
Empty file removed src/components/atoms/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions src/components/atoms/Button/Button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import styled from '@xstyled/styled-components'

const Button = styled.buttonBox``

export default Button
1 change: 1 addition & 0 deletions src/components/atoms/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Button'
7 changes: 7 additions & 0 deletions src/components/atoms/Div/Div.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from '@xstyled/styled-components'

const Div = styled.divBox`
background-color: white;
`

export default Div
1 change: 1 addition & 0 deletions src/components/atoms/Div/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Div'
43 changes: 43 additions & 0 deletions src/components/atoms/Img/Img.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import ImageNext, { ImageProps } from 'next/image'

const Image = ({
src,
width,
height,
layout,
loader,
quality,
priority,
loading,
lazyBoundary,
placeholder,
blurDataURL,
unoptimized,
objectFit,
objectPosition,
onLoadingComplete,
...props
}: ImageProps) => (
<ImageNext
{...{
src,
width,
height,
layout,
loader,
quality,
priority,
loading,
lazyBoundary,
placeholder,
blurDataURL,
unoptimized,
objectFit,
objectPosition,
onLoadingComplete,
}}
{...props}
/>
)

export default Image
1 change: 1 addition & 0 deletions src/components/atoms/Img/indes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Img'
5 changes: 5 additions & 0 deletions src/components/atoms/Input/Input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import styled from '@xstyled/styled-components'

const Input = styled.divBox``

export default Input
1 change: 1 addition & 0 deletions src/components/atoms/Input/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Input'
5 changes: 5 additions & 0 deletions src/components/atoms/P/P.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import styled from '@xstyled/styled-components'

const P = styled.pBox``

export default P
1 change: 1 addition & 0 deletions src/components/atoms/P/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './P'
26 changes: 26 additions & 0 deletions src/components/common/Compose/Compose.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { JSXElementConstructor, PropsWithChildren, ReactNode } from 'react'

type ComposeProps = {
components: {
render: JSXElementConstructor<PropsWithChildren<any>>
props?: Record<string, unknown>
}[]
children: ReactNode
}

const Compose = ({ components = [], children }: ComposeProps) => {
return (
<>
{components.reduceRight((acc, component) => {
const ComponentToRender = component.render
const componentProps = component.props

return <ComponentToRender {...componentProps}>{acc}</ComponentToRender>
}, children)}
</>
)
}

export default Compose
1 change: 1 addition & 0 deletions src/components/common/Compose/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Compose'
23 changes: 0 additions & 23 deletions src/components/common/Head/Head.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/common/Head/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/components/common/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/contexts/AppProvider/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ type AppProviderProps = {
children: ReactNode
}

const AppProvider = ({ children, ...props }: AppProviderProps) => (
<AuthProvider {...props}>{children}</AuthProvider>
const AppProvider = ({ children }: AppProviderProps) => (
<AuthProvider>{children}</AuthProvider>
)

export default AppProvider
9 changes: 5 additions & 4 deletions src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createContext, useState, useEffect, ReactNode } from 'react'
import useSWR from 'swr'

import { DEFAULT_LOGIN_PAGE_REDIRECT_PATH } from 'constants/auth'
import { nexpyClientSideApi } from 'providers'
import { nexpyClientSideClient } from 'providers'
import { signInService, revalidateUserService } from 'services/auth'
import {
clearCurrentSessionCookie,
Expand All @@ -20,7 +20,7 @@ type AuthProviderProps = {

export const AuthContext = createContext({} as AuthContextValue)

export const AuthProvider = ({ children, ...props }: AuthProviderProps) => {
export const AuthProvider = ({ children }: AuthProviderProps) => {
const [user, setUser] = useState<User | null>(null)

const unobfuscatedToken = getAuthTokenOrUndefined()
Expand Down Expand Up @@ -50,7 +50,9 @@ export const AuthProvider = ({ children, ...props }: AuthProviderProps) => {
const registerSession = (userData: User) => {
const currentToken = userData.auth.token

nexpyClientSideApi.defaults.headers.Authorization = `Bearer ${currentToken}`
if (nexpyClientSideClient.defaults.headers) {
nexpyClientSideClient.defaults.headers.Authorization = `Bearer ${currentToken}`
}

writeSessionCookie(currentToken)
setUser(userData)
Expand Down Expand Up @@ -101,7 +103,6 @@ export const AuthProvider = ({ children, ...props }: AuthProviderProps) => {
signIn,
signOut,
}}
{...props}
>
{children}
</AuthContext.Provider>
Expand Down
3 changes: 1 addition & 2 deletions src/contexts/BusinessInfoContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ export const BusinessInfoContext = createContext({} as BusinessInfo)
export const BusinessInfoProvider = ({
businessInfo,
children,
...props
}: BusinessInfoProviderProps) => (
<BusinessInfoContext.Provider value={businessInfo} {...props}>
<BusinessInfoContext.Provider value={businessInfo}>
{children}
</BusinessInfoContext.Provider>
)
6 changes: 2 additions & 4 deletions src/contexts/LocaleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ type LocaleProviderProps = {

export const LocaleContext = createContext('pt-BR' as LocaleKeys)

export const LocaleProvider = ({ locale, children, ...props }: LocaleProviderProps) => (
<LocaleContext.Provider value={locale} {...props}>
{children}
</LocaleContext.Provider>
export const LocaleProvider = ({ locale, children }: LocaleProviderProps) => (
<LocaleContext.Provider value={locale}>{children}</LocaleContext.Provider>
)
Loading

1 comment on commit 4fc3ba4

@vercel
Copy link

@vercel vercel bot commented on 4fc3ba4 Oct 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.