Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
676d8b3
:tada: Feat: Initializing project and setup linters/styles.
Jun 9, 2021
3ed70d3
:package: Build: Add axios dependency
Jun 9, 2021
1ff364b
:sparkles: Feat: initializing axios instance
Jun 9, 2021
d00e376
:bug: Fix: add baseUrl from config file
Jun 9, 2021
dc0384c
:sparkles: Feat: Add config file for "env" variables
Jun 9, 2021
d9a50ee
:sparkles: Feat: Add useAxios hook
Jun 9, 2021
5e3e0a1
:construction_worker: :sparkles: WIP: featuring simple login page on app
Jun 9, 2021
1438938
:bug: Adding new styles for index, and using theme variables
Jun 9, 2021
3ed2459
:lipstick: :sparkles: Feat: featuring new button component
Jun 9, 2021
770845a
:lipstick: :sparkles: Feat: featuring new card component
Jun 9, 2021
15fbf28
:lipstick: :sparkles: Feat: featuring new text input component
Jun 9, 2021
b9ee90a
:lipstick: :sparkles: Feat: featuring new title component
Jun 9, 2021
9399e01
:sparkles: Feat: add new variables and change some values
Jun 9, 2021
c511e15
Feat: :package: Adicionando react router dom e jest
Jun 11, 2021
a05f73c
Feat: :package: Adicionando react router dom e jest
Jun 11, 2021
70606f0
Feat: :sparkles: Adicionando rotas e o auth provider
Jun 11, 2021
a468151
Feat: :lipstick: Adicionando asset da página 404
Jun 11, 2021
0ed7358
Refactor: :hammer: Refatorando e adicionando forward ref
Jun 11, 2021
ae2e54c
Fix: :bug: corrigindo base url
Jun 11, 2021
d8f609a
Feat: :sparkles: Adicionando o AuthContext!
Jun 11, 2021
ce921a5
Feat: :sparkles: adding apihelper, an axios wrapper
Jun 11, 2021
08b7e88
Feat: :sparkles: add react router dom history helper
Jun 11, 2021
88ad2f9
Feat: :sparkles: Add useAuth hook
Jun 11, 2021
0aebd1c
Perf: :fire: Deleted unused hook
Jun 11, 2021
c3cb412
Feat: :sparkles: Add useLocalStorage hook
Jun 11, 2021
e380316
Feat: :sparkles: Add dashboard page
Jun 11, 2021
f4f7a5f
Feat: :lipstick: Add dashboard styles
Jun 11, 2021
2b4f73c
Feat: :sparkles: Add login page
Jun 11, 2021
02b8a47
Feat: :sparkles: Add not found page
Jun 11, 2021
5625551
Feat: :lipstick: Add not found page styles
Jun 11, 2021
c9edb00
Feat: :sparkles: Add AuthRoute component for protected routes
Jun 11, 2021
e9b0c83
Feat: :sparkles: Add routes
Jun 11, 2021
cdc6c64
Feat: :sparkles: Add isValidEmail util
Jun 11, 2021
8f580d0
Feat: :sparkles: Add isValidUrl util
Jun 11, 2021
09265f6
Feat: :sparkles: Add new packages and scripts for testing
Jun 11, 2021
4aa96d3
Feat: :sparkles: Add jest setup file
Jun 11, 2021
0631bfd
Test: :rotating_light: Add button test and snapshot
Jun 11, 2021
f4d54a6
Test: :rotating_light: Add card component test and snapshot
Jun 11, 2021
daa7dfb
Test: :rotating_light: Add input component test and snapshot
Jun 11, 2021
41649f1
Test: :rotating_light: Add title component test and snapshot
Jun 11, 2021
44803c4
Test: :rotating_light: Add Snackbar component test and snapshot
Jun 11, 2021
ab2ae5f
Feat: :sparkles: add Snackbar provider
Jun 11, 2021
1c75cd1
Feat: :sparkles: Add snackbar component
Jun 11, 2021
bf01a82
Feat: :lipstick: Add snackbar component styles
Jun 11, 2021
4f3f197
Feat: :sparkles: Add snackbar context
Jun 11, 2021
44a24f9
Fix: :bug: Fixing alert log on error
Jun 11, 2021
5554a58
Feat: :sparkles: add use snack bars hook
Jun 11, 2021
0552c7b
Feat: :sparkles: add call to use snack bars hook on login page
Jun 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions react-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"standard",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {}
}
5 changes: 5 additions & 0 deletions react-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
6 changes: 6 additions & 0 deletions react-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
18 changes: 18 additions & 0 deletions react-app/__tests__/components/Button.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as renderer from 'react-test-renderer'
import { Button } from '../../src/components/Button'

describe('<Button /> component', () => {
test('should renders correctly', async () => {
const props = {
title: 'Test',
isLoading: false,
onClick: () => {
return
},
}

const tree = renderer.create(<Button {...props} />).toJSON()

expect(tree).toMatchSnapshot()
})
})
9 changes: 9 additions & 0 deletions react-app/__tests__/components/Card.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as renderer from 'react-test-renderer'
import { Card } from '../../src/components/Card'

describe('<Card /> component', () => {
test('should renders correctly', async () => {
const tree = renderer.create(<Card />).toJSON()
expect(tree).toMatchSnapshot()
})
})
15 changes: 15 additions & 0 deletions react-app/__tests__/components/Input.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as renderer from 'react-test-renderer'
import { Input } from '../../src/components/Input'

describe('<Input /> component', () => {
test('should renders correctly', async () => {
const props = {
title: 'Email',
ref: null,
}

const tree = renderer.create(<Input {...props} />).toJSON()

expect(tree).toMatchSnapshot()
})
})
12 changes: 12 additions & 0 deletions react-app/__tests__/components/SnackBar.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as renderer from 'react-test-renderer'
import { SnackBar } from '../../src/components/Snackbar'

describe('<SnackBar /> component', () => {
test('should renders correctly', async () => {
const props = {
title: 'Test',
}
const tree = renderer.create(<SnackBar {...props} />).toJSON()
expect(tree).toMatchSnapshot()
})
})
11 changes: 11 additions & 0 deletions react-app/__tests__/components/Title.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as renderer from 'react-test-renderer'
import { Title } from '../../src/components/Title'

describe('<Title /> component', () => {
test('should renders correctly', async () => {
const tree = renderer.create(<Title>Test</Title>).toJSON()
expect(tree).toMatchSnapshot({
children: expect.arrayContaining(['Test']),
})
})
})
10 changes: 10 additions & 0 deletions react-app/__tests__/components/__snapshots__/Button.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Button /> component should renders correctly 1`] = `
<button
className="button"
onClick={[Function]}
>
Test
</button>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Card /> component should renders correctly 1`] = `
<div
className="container"
/>
`;
17 changes: 17 additions & 0 deletions react-app/__tests__/components/__snapshots__/Input.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Input /> component should renders correctly 1`] = `
<div
className="wrapper"
>
<input
className="floating-input"
placeholder="Email"
/>
<span
className="floating-label"
>
Email
</span>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<SnackBar /> component should renders correctly 1`] = `
<div
className="snackbar"
>
Test
</div>
`;
13 changes: 13 additions & 0 deletions react-app/__tests__/components/__snapshots__/Title.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Title /> component should renders correctly 1`] = `
Object {
"children": ArrayContaining [
"Test",
],
"props": Object {
"className": "title",
},
"type": "h1",
}
`;
18 changes: 18 additions & 0 deletions react-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap"
rel="stylesheet"
/>
<title>MasterTech App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
1 change: 1 addition & 0 deletions react-app/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom'
61 changes: 61 additions & 0 deletions react-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"serve": "vite preview",
"test": "jest",
"test:watch": "jest --watch"
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"moduleNameMapper": {
"\\.(css|scss)$": "identity-obj-proxy"
}
},
"dependencies": {
"axios": "^0.21.1",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-router-dom": "^5.2.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.13.0",
"@testing-library/react": "^11.2.7",
"@types/jest": "^26.0.23",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-router-dom": "^5.1.7",
"@types/react-test-renderer": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^4.26.1",
"@typescript-eslint/parser": "^4.26.1",
"@vitejs/plugin-react-refresh": "^1.3.1",
"eslint": "^7.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-react": "^7.24.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.0.4",
"prettier": "^2.3.1",
"react-test-renderer": "^17.0.2",
"sass": "^1.34.1",
"ts-jest": "^27.0.3",
"typescript": "^4.3.2",
"vite": "^2.3.7"
}
}
18 changes: 18 additions & 0 deletions react-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { FC } from 'react'
import { Router } from 'react-router-dom'
import { history } from './helpers/history'
import { Routes } from './routes'
import { AuthProvider } from './context/AuthContext'
import { SnackBarProvider } from './context/SnackBarContext'

export const App: FC = () => {
return (
<AuthProvider>
<SnackBarProvider>
<Router history={history}>
<Routes />
</Router>
</SnackBarProvider>
</AuthProvider>
)
}
1 change: 1 addition & 0 deletions react-app/src/assets/404.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions react-app/src/components/Button/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@use "../../themes/variables.scss" as theme;

.button {
display: flex;
align-items: center;
justify-content: center;
background: none;
border: none;
padding: 10px;
background-color: theme.$color-yellow-primary;
box-shadow: theme.$shadow;
color: black;
@extend .text-lg;
font-weight: theme.$font-bold;
width: 100%;
max-width: 100px;
margin: theme.$margin-default;
cursor: pointer;
transition: transform 0.25s ease, box-shadow 0.25s ease,
background-color 0.25s ease;
}

.button:hover {
transform: translate3d(0px, -1px, 0px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

.donut-spinner {
border: 4px solid white;
border-left-color: black;
border-radius: 50%;
width: 20px;
height: 20px;
animation: donut-spin 1.2s linear infinite;
}

@keyframes donut-spin {
to {
transform: rotate(1turn);
}
}
20 changes: 20 additions & 0 deletions react-app/src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ButtonHTMLAttributes, FC } from 'react'
import './index.scss'

type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
title: string
isLoading: boolean
}

export const Button: FC<ButtonProps> = ({
children,
title,
isLoading,
...props
}) => {
return (
<button className="button" {...props}>
{isLoading ? <div className="donut-spinner" /> : title}
</button>
)
}
6 changes: 6 additions & 0 deletions react-app/src/components/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { FC } from 'react'
import './styles.scss'

export const Card: FC = ({ children }) => {
return <div className="container">{children}</div>
}
14 changes: 14 additions & 0 deletions react-app/src/components/Card/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@use "../../themes/variables.scss" as theme;

.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
width: 85vw;
max-width: 600px;
height: auto;
background-color: #fff;
box-shadow: theme.$shadow;
padding: 15px;
}
22 changes: 22 additions & 0 deletions react-app/src/components/Input/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FC, forwardRef, HTMLProps, InputHTMLAttributes } from 'react'
import './styles.scss'

type InputProps = HTMLProps<HTMLInputElement> & {
title: string
}

export const Input = forwardRef<HTMLInputElement, InputProps>(
({ title, ...props }, ref) => {
return (
<div className="wrapper">
<input
className="floating-input"
ref={ref}
placeholder={title}
{...props}
/>
<span className="floating-label">{title}</span>
</div>
)
}
)
Loading