generated from future4code/labe-commerce-template
-
Notifications
You must be signed in to change notification settings - Fork 0
PR de correçao #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ghost
wants to merge
38
commits into
correcao-projeto
Choose a base branch
from
master
base: correcao-projeto
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
PR de correçao #17
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c55afe6
início do projeto com a criacao do componente inputsfilters e estiliz…
julianapedroso c4f2d98
criacao dos cards dos produtos e estilizacao
julianapedroso b0aa9db
Merge pull request #1 from future4code/labe-commerce6-juliana
Ana-Moreira 6f90bdd
Criaçao do state das imagens e renderizaçao na tela com map
felipemimoura 1a2d79f
atualização
5965e5d
Merge pull request #2 from future4code/labe-commerce6-felipe
julianapedroso 90dcc4a
Merge branch 'master' into ana-paula
felipemimoura a69c501
Merge pull request #3 from future4code/ana-paula
julianapedroso cfc328b
nova versao
julianapedroso cf9965d
Merge pull request #4 from future4code/labe-commerce6-juliana3
Ana-Moreira 1e171d3
alguma alteração de teste
felipemimoura c2bba55
alterações de testes
felipemimoura ce536f7
Criação da lógica dos inputs de valores mininos e maximos, e correção…
felipemimoura e30b7c6
Criação do input de busca através do texto e tentantiva de filtrar
felipemimoura 5415469
Merge pull request #5 from future4code/labe-commerce6-felipe3
julianapedroso 146c0ad
correção do layout e criação do botão do carrinho de compra
felipemimoura de3e723
Merge pull request #6 from future4code/labe-commerce6-felipe3
Ana-Moreira d038542
criação da lógica de filtros de valores mínimos
felipemimoura 4961974
Merge pull request #7 from future4code/filtro-valor-minino
Ana-Moreira bb84846
Filtros minimos e máximos resolvidos
felipemimoura 9ee5e9e
Merge pull request #8 from future4code/filtro-valor-maximo
julianapedroso e731bbd
filtro pelo nome do produto funcionando
felipemimoura 573d113
Merge pull request #9 from future4code/filtro-nome
Ana-Moreira 989881b
Começo da logica de adicionar itens no carrinho
felipemimoura f403646
Merge pull request #10 from future4code/criacao-carrinho
julianapedroso 030dbb7
lógica de mostrar carrinho
felipemimoura 2d3ea44
Merge pull request #11 from future4code/criacao-carrinho
julianapedroso 22751e5
inicio da logica de adicionar itens no carrinho
felipemimoura 3dee5fb
Merge pull request #12 from future4code/adicina-produtos-carinho
julianapedroso 5e0f61e
logica de adicionar ao carrinho resolvida
felipemimoura 13a8ac4
Merge pull request #13 from future4code/adicina-produtos-carinho
julianapedroso 4e4315c
criação do surge
felipemimoura 164cd0f
Merge pull request #14 from future4code/remover-produto
Ana-Moreira e00b313
criada a lógica para o botão remover item do carrinho e pequenos ajustes
julianapedroso d067db2
Merge pull request #15 from future4code/labe-commerce6-juliana5
Ana-Moreira c40601b
pequenos ajustes estéticos e organização no código
julianapedroso f19e7f6
Update README.md
julianapedroso f58550d
Merge pull request #16 from future4code/pequenos-ajustes
Ana-Moreira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "cSpell.words": [ | ||
| "labenu" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| Sejam bem vindos ao Labe-commerce, esse repositório contém um esqueleto de app React e um .gitignore. | ||
| Link do surge: http://high-pitched-support.surge.sh/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,199 @@ | ||
| import React from 'react'; | ||
| import logo from './logo.svg'; | ||
| import './App.css'; | ||
|
|
||
| function App() { | ||
| return ( | ||
| <div className="App"> | ||
| <header className="App-header"> | ||
| <img src={logo} className="App-logo" alt="logo" /> | ||
| <p> | ||
| Edit <code>src/App.js</code> and save to reload. | ||
| </p> | ||
| <a | ||
| className="App-link" | ||
| href="https://reactjs.org" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| Learn React | ||
| </a> | ||
| </header> | ||
| </div> | ||
| ); | ||
| import React from "react"; | ||
| import "./App.css"; | ||
| import Cards from "./components/Cards"; | ||
| import { | ||
| InputsFilters, | ||
| Container, | ||
| CardContainer, | ||
| Texts, | ||
| } from "./components/styled"; | ||
| import CartItem from "./components/CartItens"; | ||
|
|
||
| class App extends React.Component { | ||
| state = { | ||
| itemCard: [ | ||
| { | ||
| id: 1, | ||
| img: "https://picsum.photos/300/300?a=1", | ||
| item: `Item A`, | ||
| price: 1, | ||
| }, | ||
| { | ||
| id: 2, | ||
| img: "https://picsum.photos/300/300?a=2", | ||
| item: `Item B`, | ||
| price: 2000, | ||
| }, | ||
| { | ||
| id: 3, | ||
| img: "https://picsum.photos/300/300?a=3", | ||
| item: `Item C`, | ||
| price: 25.5, | ||
| }, | ||
| { | ||
| id: 4, | ||
| img: "https://picsum.photos/300/300?a=4", | ||
| item: `Item D`, | ||
| price: 25.95, | ||
| }, | ||
| { | ||
| id: 5, | ||
|
|
||
| img: "https://picsum.photos/300/300?a=5", | ||
| item: `Item E`, | ||
| price: 789.87, | ||
| }, | ||
| { | ||
| id: 6, | ||
| img: "https://picsum.photos/300/300?a=6", | ||
| item: `Item F`, | ||
| price: 453.28, | ||
| }, | ||
| { | ||
| id: 7, | ||
| img: "https://picsum.photos/300/300?a=7", | ||
| item: `Item G`, | ||
| price: 236.63, | ||
| }, | ||
| { | ||
| id: 8, | ||
| img: "https://picsum.photos/300/300?a=8", | ||
| item: `Item H`, | ||
| price: 456.98, | ||
| }, | ||
| ], | ||
| cart: [], | ||
| inputValueMin: 0, | ||
| inputValueMax: Infinity, | ||
| inputText: "", | ||
| cartVisible: false, | ||
| }; | ||
|
|
||
| onChangeValueMin = (e) => { | ||
| const valueMin = e.target.value; | ||
| this.setState({ | ||
| inputValueMin: valueMin, | ||
| }); | ||
| }; | ||
|
|
||
| onChangeValueMax = (e) => { | ||
| const valueMax = e.target.value; | ||
| this.setState({ | ||
| inputValueMax: valueMax, | ||
| }); | ||
| }; | ||
|
|
||
| filterName = (e) => { | ||
| const valueText = e.target.value; | ||
| this.setState({ | ||
| inputText: valueText, | ||
| }); | ||
| }; | ||
|
|
||
| getFilterAddLista = () => { | ||
| return this.state.itemCard | ||
| .filter((produto) => { | ||
| return this.state.inputValueMin > 0 | ||
| ? produto.price > this.state.inputValueMin | ||
| : produto; | ||
| }) | ||
| .filter((produto) => { | ||
| return this.state.inputValueMax < Infinity | ||
| ? produto.price < this.state.inputValueMax | ||
| : produto; | ||
| }) | ||
| .filter((produto) => { | ||
| const produtoNome = produto.item.toLowerCase(); | ||
| return produtoNome.indexOf(this.state.inputText.toLowerCase()) > -1; | ||
| }); | ||
| }; | ||
|
|
||
| cartVisible = () => { | ||
| this.setState({ | ||
| cartVisible: !this.state.cartVisible, | ||
| }); | ||
| }; | ||
|
|
||
| addCartItem = (id) => { | ||
| const addItem = this.state.itemCard.filter((item) => { | ||
| return item.id === id; | ||
| }); | ||
| const newCart = [...this.state.cart, addItem[0]]; | ||
| this.setState({ | ||
| cart: newCart, | ||
| }); | ||
| }; | ||
|
|
||
| removeCartItem = (id) => { | ||
| const novoCarrinho = this.state.cart; | ||
| const indexProduto = novoCarrinho.findIndex((item) => { | ||
| return item.id === id; | ||
| }); | ||
|
|
||
| novoCarrinho.splice(indexProduto, 1); | ||
|
|
||
| this.setState({ cart: novoCarrinho }); | ||
| }; | ||
|
|
||
| render() { | ||
| const listaFiltrada = this.getFilterAddLista(); | ||
| const itemList = listaFiltrada.map((item) => { | ||
| return ( | ||
| <div key={item.id}> | ||
| <Cards | ||
| id={item.id} | ||
| itemPhoto={item.img} | ||
| itemName={item.item} | ||
| priceItem={item.price} | ||
| addCartItem={this.addCartItem} | ||
| removeCartItem={this.removeCartItem} | ||
| /> | ||
| </div> | ||
| ); | ||
| }); | ||
|
|
||
| return ( | ||
| <div className="App"> | ||
| <Container cartVisible={this.state.cartVisible}> | ||
| <InputsFilters> | ||
| <Texts>Valor Mínimo: </Texts> | ||
| <input | ||
| value={this.state.inputValueMin} | ||
| onChange={this.onChangeValueMin} | ||
| min="0" | ||
| type="number" | ||
| /> | ||
| <Texts>Valor Máximo: </Texts> | ||
| <input | ||
| value={this.state.inputValueMax} | ||
| onChange={this.onChangeValueMax} | ||
| min="0" | ||
| type="number" | ||
| /> | ||
|
|
||
| <Texts>Buscar Produto: </Texts> | ||
| <input onChange={this.filterName} type="text" /> | ||
| </InputsFilters> | ||
| <CardContainer> | ||
| {/* <div> | ||
| <p>Quantidade de Produtos</p> | ||
| <select> | ||
| <option value="crescente">Crescente</option> | ||
| <option value="decrescente">decrescente</option> | ||
| </select> | ||
| </div> */} | ||
|
|
||
| {itemList} | ||
| </CardContainer> | ||
| {this.state.cartVisible && ( | ||
| <CartItem estado={this.state.cart} remove={this.removeCartItem} /> | ||
| )} | ||
| </Container> | ||
| {/* <CartButton showCart={this.cartVisible}></CartButton> */} | ||
| <button id="buttonCart" onClick={this.cartVisible}>Carrinho</button> | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import React from "react"; | ||
|
|
||
| export default class CartButton extends React.Component { | ||
| render() { | ||
| return <button> Carrinho</button>; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import React from "react"; | ||
| import { ItemCard, ContainerCards, ButtonAddCar, Images } from "./styled"; | ||
|
|
||
| export default class Cards extends React.Component { | ||
| render() { | ||
| return ( | ||
| <ContainerCards> | ||
| <ItemCard> | ||
| <Images src={this.props.itemPhoto} alt="Imagem do produto" /> | ||
| <p>{this.props.itemName}</p> | ||
| <p>R$ {this.props.priceItem}</p> | ||
|
|
||
| <ButtonAddCar onClick={() => this.props.addCartItem(this.props.id)}> | ||
| Adicionar ao carrinho | ||
| </ButtonAddCar> | ||
| </ItemCard> | ||
| </ContainerCards> | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import React from "react"; | ||
| import styled from "styled-components"; | ||
|
|
||
| const ContainerCartItem = styled.div` | ||
| border: 1px solid black; | ||
| height: auto; | ||
| margin: 0.5em 0.5em 0 0.5em; | ||
| padding: 0.5em; | ||
| `; | ||
|
|
||
| export default class CartItem extends React.Component { | ||
| render() { | ||
| const cartItem = this.props.estado.map((produto) => { | ||
| console.log(produto.id); | ||
| return ( | ||
| <div key={produto.id}> | ||
| <p> | ||
| <strong>Produto: </strong> | ||
| {produto.item} | ||
| </p> | ||
|
|
||
| <p> R$ {produto.price}</p> | ||
| <p>-------------------------</p> | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A tag poderia resolver essa linha pra voces!
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ( hr ) |
||
| <button onClick={() => this.props.remove(this.props.id)}>X</button> | ||
| </div> | ||
| ); | ||
| }); | ||
| return ( | ||
| <ContainerCartItem> | ||
| <p>{cartItem}</p> | ||
| </ContainerCartItem> | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import React from "react"; | ||
| import { InputsFilters, Texts } from "./styled"; | ||
|
|
||
| export default class Filters extends React.Component { | ||
| render() { | ||
| return ( | ||
| <InputsFilters> | ||
| </InputsFilters> | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quando muitos produtos sao adicionados, o carrinho de produtos aumenta junto e a experiencia fica um pouco ruim com o site! Tentem dar uma olhada na propriedade overflow do CSS, que é geralmente usada para resolver esse problema.