-
Notifications
You must be signed in to change notification settings - Fork 0
Semana 8 gabriel #3
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
base: master
Are you sure you want to change the base?
Changes from all commits
189ffc6
2670014
62ee8c8
d507b85
82ad30d
cef2f0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ | |
| ], | ||
| "linebreak-style":[ | ||
| "error", | ||
| "unix" | ||
| "windows" | ||
| ], | ||
| "quotes":[ | ||
| "error", | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { createGlobalStyle } from 'styled-components'; | ||
| import { font_family_page } from './Variables'; | ||
|
|
||
| export const GlobalStyle = createGlobalStyle` | ||
| body{ | ||
| font-family: $font-family-page; | ||
| text-decoration: none; | ||
| overflow-x:hidden ; | ||
| scroll-behavior: smooth; | ||
| } | ||
|
|
||
| `; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export const primary_color = '#FFEF82'; | ||
|
Collaborator
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. O Styled Components tem uma forma mais legal de você fazer esse tipo de coisas, criando um tema: https://styled-components.com/docs/advanced#theming |
||
|
|
||
| export const secondary_color = '#EFD345'; | ||
|
|
||
| export const tertiary_color = '#BABD42'; | ||
|
|
||
| export const quaternary_color = '#82954B'; | ||
|
|
||
| export const font_size_text = '1em'; | ||
|
|
||
| export const font_size_title = '3em'; | ||
|
|
||
| export const font_size_subtitle = '4em'; | ||
|
|
||
| export const font_family_page = '\'Roboto\', sans serif'; | ||
|
|
||
| export const font_weight_text = '300'; | ||
|
|
||
| export const font_weight_title = 'bold'; | ||
|
|
||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,32 @@ | ||
| import { cartState } from 'pages/state/atoms/cartState'; | ||
| import { useRecoilValue } from 'recoil'; | ||
| import style from './BillingReview.module.scss'; | ||
| import { cartState } from 'state/atoms/dynamic/cartState'; | ||
| import { ButtonPayment, ReviewPayment, ReviewPaymentConfig } from './BillingReviewStyle'; | ||
|
|
||
| export function BillingReview() { | ||
|
|
||
| const getCart = useRecoilValue(cartState); | ||
| const cart = [...getCart]; | ||
|
Collaborator
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. Você não precisa duplicar o cart aqui. |
||
| const total = cart.reduce((acc, currentValue) => (acc += currentValue.price),0); | ||
| const total = cart.reduce( | ||
| (acc, currentValue) => (acc += (currentValue.price*currentValue.units_in_cart)), | ||
| 0 | ||
| ); | ||
|
|
||
| return ( | ||
|
|
||
|
|
||
| <div className={style.review__payment}> | ||
| <div className={style['review__payment--config']}> | ||
| <ReviewPayment> | ||
| <ReviewPaymentConfig> | ||
| {cart.map((productsInCart) => { | ||
| return ( | ||
| <> | ||
| <p key={productsInCart.id} >2x{(productsInCart.price + productsInCart.price * 0.1).toFixed(2)} = R$ {productsInCart.price.toFixed(2)}</p> | ||
|
|
||
| <p key={productsInCart.id}> | ||
|
Collaborator
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. Acho que a tag P não é a melhor pra esse caso, se pensarmos bem, é uma lista de itens, talvez uma ul li fizesse mais sentido.
Collaborator
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. Isso poderia ser um componente |
||
| {productsInCart.units_in_cart}x | ||
| {(productsInCart.price).toFixed(2)}{' '} | ||
| = R$ {(productsInCart.price*productsInCart.units_in_cart).toFixed(2)} | ||
| </p> | ||
| </> | ||
| ); | ||
| })} | ||
| })} | ||
| <p>Total: R${total.toFixed(2)}</p> | ||
| <button>Ir para pagamento</button> | ||
| </div> | ||
|
|
||
|
|
||
| </div> | ||
| <ButtonPayment as='button'>Ir para pagamento</ButtonPayment> | ||
| </ReviewPaymentConfig> | ||
| </ReviewPayment> | ||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { CartButtonDetails } from '../../components/Button/ButtonStyle'; | ||
| import styled from 'styled-components'; | ||
| import { font_size_text, font_weight_text, primary_color, tertiary_color } from 'Variables'; | ||
|
Collaborator
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. camelCase é mais comum para nomear variáveis no JavaScript/TypeScript. |
||
|
|
||
| export const ReviewPayment = styled.div` | ||
| width: 100%; | ||
| button { | ||
| display: block; | ||
| margin: auto; | ||
| margin-top: 159%; | ||
| border: none; | ||
| height: 3em; | ||
| background-color: $tertiary-color; | ||
| } | ||
|
|
||
| button:hover { | ||
| color: white; | ||
| cursor: pointer; | ||
| } | ||
| `; | ||
|
|
||
| export const ReviewPaymentConfig = styled.div` | ||
| height: 100%; | ||
| padding: 11%; | ||
| padding-top: 0; | ||
| text-align: center; | ||
| font-weight: ${font_weight_text}; | ||
| font-size:calc(${font_size_text}*1.5); | ||
| background-color: ${tertiary_color}; | ||
| `; | ||
|
|
||
| export const ButtonPayment = styled(CartButtonDetails)` | ||
| background-color:${primary_color}; | ||
| width: 205px; | ||
| color:black; | ||
| &:hover{ | ||
| border: 1px solid ${primary_color}; | ||
| background-color:transparent; | ||
| } | ||
| `; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,10 @@ | ||
| import { ProductReview } from './ProductReview/ProductReview'; | ||
|
|
||
| export function Cart() { | ||
| return <> | ||
|
|
||
| return ( | ||
| <main> | ||
|
|
||
| <h1>Minha sacola</h1> | ||
| <section className="review"> | ||
| <ProductReview/> | ||
| </section> | ||
|
|
||
| <h1>Minha sacola</h1> | ||
| <ProductReview /> | ||
| </main> | ||
|
|
||
| </>; | ||
| } | ||
| ); | ||
| } |
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,40 @@ | ||
|
|
||
|
Collaborator
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. Componentes não deveriam estar dentro de Pages. |
||
| import { cartState } from 'pages/state/atoms/cartState'; | ||
| import { useRecoilValue } from 'recoil'; | ||
| import { ImageProductReview } from '../ImageProductReview/ImageProductReview'; | ||
| import { cartState } from 'state/atoms/dynamic/cartState'; | ||
| import style from './InfoReview.module.scss'; | ||
| import { | ||
| InfoReviewContent, | ||
| InfoReviewTemplate, | ||
| InfoReviewTitle, | ||
| } from './InfoReviewStyle'; | ||
| import { ReviewItem } from './ReviewItem/ReviewItem'; | ||
| import { ReviewTitle } from './ReviewTitle/ReviewTitle'; | ||
|
|
||
| export function InfoReview() { | ||
|
|
||
| const getItem = useRecoilValue(cartState); | ||
|
|
||
| const productsInCart = [...getItem]; | ||
|
|
||
|
|
||
| //console.log(productsOnCart) | ||
| return ( | ||
| <div className={`${style.review__info}`}> | ||
|
|
||
| <InfoReviewTemplate> | ||
| <> | ||
| <div className={style['review__info--title']} > | ||
| <InfoReviewTitle> | ||
| <ReviewTitle /> | ||
|
|
||
| </div> | ||
| { | ||
| productsInCart.map((product, productCartindex) => { | ||
| return ( | ||
| <div key={product.id} className={style['review__info--item']}> | ||
|
|
||
| <ReviewItem | ||
| //melhorar esse codigo | ||
|
|
||
| item={productsInCart.find((_, indice) => indice === productCartindex)} | ||
| /> | ||
| </div> | ||
|
|
||
| ); | ||
| }) | ||
| } | ||
| </InfoReviewTitle> | ||
| {productsInCart.map((product, productCartindex) => { | ||
| return ( | ||
| <InfoReviewContent key={product.id}> | ||
| <ReviewItem | ||
| //melhorar esse codigo | ||
|
|
||
| item={productsInCart.find( | ||
| (_, indice) => indice === productCartindex | ||
| )} | ||
|
Comment on lines
+30
to
+32
Collaborator
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. Aqui você já tem o product em uma variável, buscar ele pelo índice novamente dentro do array não faz sentido. |
||
| /> | ||
| </InfoReviewContent> | ||
| ); | ||
| })} | ||
| </> | ||
| </div> | ||
| </InfoReviewTemplate> | ||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const InfoReviewTemplate = styled.div` | ||
| display: grid; | ||
| grid-template-columns: 3fr; | ||
| grid-template-rows: 1fr auto; | ||
| padding: 0 1%; | ||
| width:100%; | ||
| `; | ||
|
|
||
| export const InfoReviewTitle = styled.div` | ||
| display: flex; | ||
| flex-direction: row; | ||
| justify-content: space-around; | ||
| `; | ||
|
|
||
| export const InfoReviewContent = styled.div` | ||
| display: flex; | ||
| align-items: center; | ||
| flex-direction: row; | ||
| justify-content: space-around; | ||
| `; |
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.
styled e components aqui acredito que foram instalados por engano, poderia remover.