Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit ce2ca5f

Browse files
committed
Create frontend challenge
0 parents  commit ce2ca5f

19 files changed

+24851
-0
lines changed

.babelrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
],
6+
"plugins": [
7+
["@babel/plugin-proposal-decorators", { "legacy": true }],
8+
"transform-class-properties",
9+
"transform-react-constant-elements",
10+
"transform-react-inline-elements"
11+
]
12+
}

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.{hbs,html}]
16+
insert_final_newline = false
17+
18+
[*.{diff,md}]
19+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "standard"
3+
}

.gitignore

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
# Created by https://www.gitignore.io/api/node
3+
# Edit at https://www.gitignore.io/?templates=node
4+
5+
### Node ###
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# Optional npm cache directory
48+
.npm
49+
50+
# Optional eslint cache
51+
.eslintcache
52+
53+
# Optional REPL history
54+
.node_repl_history
55+
56+
# Output of 'npm pack'
57+
*.tgz
58+
59+
# Yarn Integrity file
60+
.yarn-integrity
61+
62+
# dotenv environment variables file
63+
.env
64+
65+
# parcel-bundler cache (https://parceljs.org/)
66+
.cache
67+
68+
# next.js build output
69+
.next
70+
71+
# nuxt.js build output
72+
.nuxt
73+
74+
# vuepress build output
75+
.vuepress/dist
76+
77+
# Serverless directories
78+
.serverless
79+
80+
# FuseBox cache
81+
.fusebox/
82+
83+
# End of https://www.gitignore.io/api/node

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<img src="https://www.creditas.com.br/static/images/logo-creditas-color-8367919c2a.svg" width="400">
2+
3+
# Challenge Frontend - Creditas
4+
Esse é um teste de nivelamento. Queremos deixar claro que não é esperado que todos consigam realizá-lo por completo, já que é destinado a todos os níveis de carreira. Esperamos que todas as pessoas que queiram trabalhar conosco tentem realizá-lo.
5+
6+
Focamos aqui em design de código e design patterns em JavaScript. O objetivo é avaliar sua experiência em escrever **código de fácil manutenção, baixo acoplamento e alta coesão**.
7+
8+
A Creditas trabalha sempre com feedbacks construtivos e, portanto, daremos sempre uma atenção especial para todos que submeterem o teste, passando para o candidato quais são os pontos positivos do seu teste e os pontos a melhorar. Vale a pena tentar! :)
9+
10+
## Apresentação do problema
11+
12+
Você deverá melhorar a calculadora de simulação de crédito implementada neste projeto.
13+
14+
A interface está previamente definida, assim como os estilos.
15+
Os desafios incluem refatorar o código e implementar funcionalidades (detalhados mais abaixo).
16+
17+
Sinta-se à vontade para componentizar o que achar que deve ser componentizado.
18+
Só gostariamos que o teste fosse realizado com Javascript puro, nosso querido vanilla. O que acha de encarar o desafio?
19+
20+
O estado atual da calculadora:
21+
<img style="display: block; margin: 0 auto;" src="./layout.png">
22+
23+
24+
25+
### Funcionalidade esperada
26+
27+
A aplicação deverá permitir ao usuário escolher o tipo de garantia que quer utilizar no pedido de empréstimo: ***"Veículo"*** ou ***"Imóvel"*** (o preenchimento padrão é *"Veículo"*) e seguir as regras de cálculo abaixo.
28+
29+
**Regras em comum**
30+
- Taxa de IOF: 6.38%;
31+
- Taxa de Juros: 2.34%;
32+
- Valor máximo para empréstimo: 80% do valor da garantia;
33+
34+
*Fórmula do valor total a pagar*
35+
36+
```javascript
37+
const valorTotalAPagar = ((iof / 100) + (taxaDeJuros / 100) + (prazo / 1000) + 1) * valorDoEmprestimo
38+
```
39+
40+
*Fórmula do valor da parcela*
41+
42+
```javascript
43+
const valorDaParcela = valorTotalAPagar / prazo
44+
```
45+
46+
## Desafios a cumprir
47+
48+
### CSS
49+
* **Refatorar para facilitar manutenção**
50+
51+
Atualmente o arquivo CSS possui muitos estilos, o que dificulta a legibilidade. Esperamos que você faça uma boa organização dos estilos, isolando-os para torná-los mais legíveis e, assim, facilitar a manutenção.
52+
53+
### HTML / JS
54+
* **Adicionar a opção de garantia _"Imóvel"_** (com as respectivas regras de cálculo)
55+
* **Refatorar código antigo (e organizar código novo) para facilitar manutenção**
56+
57+
Hoje, a Creditas possui dois produtos: empréstimo com garantia de veículo e de imóvel. O projeto atual tem implementada apenas a opção de garantia *"Veículo"*, você deve implementar a opção *"Imóvel"*.
58+
Ao mudar o tipo de garantia no elemento `select`, o usuário deve ver as opções de valores e prazos referentes ao tipo selecionado. Ou seja, ao selecionar veículo ou imóvel, você deve mostrar na tela opções diferentes nos campos do formulário e no slider. Veja abaixo os valores correspondentes:
59+
60+
**Veículo**
61+
- Valor mínimo para empréstimo: R$ 3.000,00;
62+
- Valor máximo para empréstimo: R$ 100.000,00;
63+
- Prazos para veículo : 24 / 36 / 48 meses;
64+
- Valor mínimo da garantia: R$ 5.000,00;
65+
- Valor máximo da garantia: R$ 3.000.000,00;
66+
67+
**Imóvel**
68+
- Valor mínimo para empréstimo: R$ 30.000,00;
69+
- Valor máximo para empréstimo: R$ 4.500.000,00;
70+
- Prazos para imóvel : 120 / 180 / 240 meses;
71+
- Valor mínimo da garantia: R$ 50.000,00;
72+
- Valor máximo da garantia: R$ 100.000.000,00;
73+
74+
Por fim, você deve exibir o valor da parcela no campo correspondente a cada mudança nos inputs do formulário.
75+
76+
## Desenvolvimento
77+
78+
### Pré-requisitos
79+
Você precisa minimamente do [NodeJs](https://nodejs.org/en/) instalado para rodar a apliação e o [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) para baixar o repositório e submeter um pull-request
80+
81+
### Configurações para rodar o ambiente
82+
83+
Você precisa conhecer um pouco sobre o Git, que é uma ferramenta que nos ajuda a fazer o controle de versão dos nossos arquivos.
84+
85+
```shell
86+
git clone https://github.com/Creditas/challenge.git
87+
cd frontend/
88+
npm install
89+
npm start
90+
```
91+
92+
Se tudo estiver ok, acesse a url [http://localhost:4000/](http://localhost:4000/)
93+
94+
### Construído com
95+
Este projeto possui algumas bibliotecas para nos auxiliar nos testes e rodar a aplicação, são eles: *Webpack*, *Babel*, *Jest* e *Eslint*.
96+
97+
## Tests
98+
99+
Para rodar os testes é necessário executar o comando abaixo:
100+
101+
```shell
102+
npm test
103+
```
104+
105+
## Feedback (opcional)
106+
Aqui na Creditas o feedback faz parte da nossa cultura, seria muito gratificante se, tendo concluído ou não o teste, você pudesse contribuir com nosso processo de contração respondendo [este pequeno questionário.](https://docs.google.com/forms/d/e/1FAIpQLSdTNMc2JqnvNxy4J3gAN-vQqsfG6PscH5hVQRC9dyMK1PlnRw/viewform?usp=sf_link)

README_English.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<img src="https://www.creditas.com.br/static/images/logo-creditas-color-8367919c2a.svg" width="400">
2+
3+
# Frontend Challenge - Creditas
4+
5+
This is a challenge designed to measure the candidate's expertise.
6+
We would like to clarify that we don't expect everyone to be able to finish the whole challenge, since it has been designed to cover the several degrees of expertise, from junior to senior.
7+
Nevertheless, we expect anyone interested in becoming a tripulante in Creditas to give it a try.
8+
9+
In this challenge, we focus both on code design and design patterns in JavaScript. The goal is to assess your experience in writing **code that is easy to maintain, loosely coupled and highly cohesive**.
10+
11+
At Creditas we always work giving constructive feedback, therefore we will always dedicate the outmost attention to every solution submitted; contacting you back with the positive aspects of your submission and what could be improved. Just for that it is worth trying! :)
12+
13+
## The challenge
14+
15+
You have to improve the loan simulation calculator implemented in this project.
16+
17+
Both the interface as well as the styles are provided. The challenges include refactoring the code and implemetning new functionalities (listed below).
18+
19+
Feel free to componentize whatever you think should be componentized. Our only request is that you use only pure JavaScript, our beloved Vanilla. Do you accept the challenge?
20+
21+
The calculator's current state:
22+
<img style="display: block; margin: 0 auto;" src="./layout.png">
23+
24+
25+
### Expected functionalities
26+
27+
The application must allow the user to choose the collateral type they want to use in their equity loan simulation:
28+
***"Auto"*** or ***"Home"*** (the default option is ***"Auto"*** ).
29+
30+
It should also follow the calculation rules bellow:
31+
32+
**Common Rules**
33+
- Financial Transaction Tax (FTT): 6.38%;
34+
- Interest Rate: 2.34%;
35+
- Maximum loan-to-value (amount the user can borrow): 80% of the collateral's value;
36+
37+
*Total Loan Amount Formula*
38+
39+
```javascript
40+
const totalLoanAmount = ((FTT / 100) + (interestRate / 100) + (termInMonths / 1000) + 1) * loanAmount
41+
```
42+
43+
*Monthly payment formula*
44+
45+
```javascript
46+
const monthlyPayment = totalLoanAmount / termInMonths
47+
```
48+
49+
## Challenges to achieve
50+
51+
### CSS
52+
* **Refactor to make maintainance easier**
53+
54+
Currently, the project's CSS file has too many styles, making readability difficult. We expect you to organize styles, isolating them in order to make them more readable and easier to maintain.
55+
56+
### HTML / JS
57+
* **Add new collateral type _"Home"_** (with its calculation rules)
58+
* **Refactor the old code (and arrange the new one) to make maintainance easier**
59+
60+
Currently, Creditas offers two products: home equity loan and auto equity loan. This project implements the *"auto equity"* option only, **you must implement the *"home equity"* option**.
61+
By changing the collateral type in the `select` element, the user must see the amount and term options corresponding to the product chosen. That is, when selecting either _"Home"_ or _"Auto"_, you must show the correspondent values for each option on the form fields and on the slider.
62+
Please find the corresponding values below:
63+
64+
**Auto**
65+
- Minimum loan amount: R$ 3.000,00;
66+
- Maximum loan amount: R$ 100.000,00;
67+
- Terms: 24 / 36 / 48 months
68+
- Minimum guarantee amount: R$ 5.000,00;
69+
- Maximum guarantee amount: R$ 3.000.000,00;
70+
71+
**Home**
72+
- Minimum loan amount: R$ 30.000,00;
73+
- Maximum loan amount: R$ 4.500.000,00;
74+
- Terms: 120 / 180 / 240 months
75+
- Minimum guarantee amount: R$ 50.000,00;
76+
- Maximum guarantee amount: R$ 100.000.000,00;
77+
78+
Finally, you must update the monthly payment value whenever changes in the form's inputs are done.
79+
80+
## Development
81+
82+
### Prerequisites
83+
84+
You will need to install on your machine:
85+
- [NodeJs](https://nodejs.org/en/) in order to run the application.
86+
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) in order to clone the repository containing this challenge and submit the pull request with your solution.
87+
88+
### Configuration to run the environment
89+
90+
By executing the following lines of code in your terminal you will be able to:
91+
- Clone the repository containing this challenge.
92+
- Install the necessary dependencies to run the application.
93+
- Run the application.
94+
95+
```shell
96+
git clone https://github.com/Creditas/challenge.git
97+
cd frontend/
98+
npm install
99+
npm start
100+
```
101+
102+
If everything is correct, you should be able to access the following URL: [http://localhost:4000/](http://localhost:4000/).
103+
104+
### Dependencies
105+
106+
This project uses some libraries to assist us with tests and running the application. Those are:
107+
- [https://webpack.js.org/](Webpack)
108+
- [https://babeljs.io/](Babel)
109+
- [https://jestjs.io/](Jest)
110+
- [https://eslint.org/](Eslint)
111+
112+
## Tests
113+
114+
To run the tests you must execute the following command:
115+
116+
```shell
117+
npm test
118+
```
119+
120+
## Feedback (optional)
121+
122+
As we said earlier, here at Creditas constructive feedbacks are part of our culture, so it would be very rewarding if you could contribute with our hiring process by giving us your [https://docs.google.com/forms/d/e/1FAIpQLSdwjudz38JMtMYf3rFBrMHX3XMy2J5oBLPnjBGD1QKvOM2SGg/viewform](opinion) on the challenge.
123+
We would like you to send it even if you didn't finish the challenge.

__mocks__/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {}

0 commit comments

Comments
 (0)