Skip to content

Conversation

@paula-aribeiro
Copy link

No description provided.

eloisa-castro and others added 23 commits December 5, 2019 11:06
Ajuste para filtrar os itens de acordo com os valores
Primeiros ajustes da funcionalidade do carrinho
Copy link
Author

@paula-aribeiro paula-aribeiro left a comment

Choose a reason for hiding this comment

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

Oii pessoal, ficou animal o projeto de vocês!!!

Vocês atenderam todos os requisitos que pedimos, tanto obrigatórios quanto desafios. Também fizeram um código bem componentizado, organizado, usando conceitos que ainda nem ensinamos. Elegante demais!

Uma sugestão de melhoria seria usar propTypes nos componentes, pois por ser um projeto maior pode gerar confusão com as props. Também deixei alguns comentários abaixo.

Continuem assim 🚀 👏

Comment on lines +6 to +10
function App() {
return (
<ContainerEcommerce />
);
}
Copy link
Author

Choose a reason for hiding this comment

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

Seria melhor que o App fosse o ContainerEcommerce

Comment on lines +78 to +86
componentDidMount(){
const arrCarrinhoStorage = JSON.parse(localStorage.getItem('arrCarrinho')) != null ? JSON.parse(localStorage.getItem('arrCarrinho')) : []
const valorCarrinhoStorage = localStorage.getItem('valorCarrinho') != null ? localStorage.getItem('valorCarrinho') : 0.00

this.setState({
listaCarrinho:arrCarrinhoStorage,
totalCarrinho:valorCarrinhoStorage
})
}
Copy link
Author

Choose a reason for hiding this comment

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

👏

Comment on lines +88 to +91
componentDidUpdate(){
localStorage.setItem("arrCarrinho",JSON.stringify(this.state.listaCarrinho))
localStorage.setItem("valorCarrinho",this.state.totalCarrinho)
}
Copy link
Author

Choose a reason for hiding this comment

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

Muito bom!

localStorage.setItem("valorCarrinho",this.state.totalCarrinho)
}

filtrarProdutos = (arg1, arg2, arg3) => {
Copy link
Author

Choose a reason for hiding this comment

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

Esses argumentos poderiam ter nomes mais significativos

Comment on lines +142 to +146
this.setState({ listaCarrinho: listaCarrinhoCopia,
},()=>{
this.atualizarPrecoTotal()
})
}
Copy link
Author

Choose a reason for hiding this comment

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

Booooa 👏

Copy link
Author

Choose a reason for hiding this comment

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

Não sei onde vocês aprenderam isso, mas parabéns

Comment on lines +173 to +179
if(value==="decrescente"){
listaProdutosCopia.sort(function(a,b){
return parseFloat(a.price) > parseFloat(b.price) ? -1 : parseFloat(a.price) < parseFloat(b.price) ? 1 : 0
})
}else if(value==="crescente"){
listaProdutosCopia.sort(function(a,b){
return parseFloat(a.price) > parseFloat(b.price) ? 1 : parseFloat(a.price) < parseFloat(b.price) ? -1 : 0
Copy link
Author

Choose a reason for hiding this comment

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

Forma interessante de ordenar!

Comment on lines +94 to +106
this.setState({
formControls:{
...this.state.formControls,
[name]:{
...this.state.formControls[name],
value
}
}
}, () => {this.props.transporteDeFiltros(this.state.formControls.valorMin.value,
this.state.formControls.valorMax.value,
this.state.formControls.filtro.value)
});
}
Copy link
Author

Choose a reason for hiding this comment

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

Boa, generalizando a função 👏

@@ -0,0 +1,43 @@
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
Copy link
Author

Choose a reason for hiding this comment

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

Parabéns por terem usado o material-ui, que ainda iremos ensinar 😍 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants