Skip to content
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

Add price component #4

Merged
merged 7 commits into from
Apr 5, 2018
Merged

Add price component #4

merged 7 commits into from
Apr 5, 2018

Conversation

estacioneto
Copy link
Contributor

No description provided.

react/Price.js Outdated

return (
<div className='tc b fabriga'>
{ listPriceElement }

Choose a reason for hiding this comment

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

geralmente não separamos que tá dentro do render em constantes. Não é legível. Coloca tudo no render e quando for necessário, faz um novo componente para ser reusado e ficar mais modularizado.

react/Price.js Outdated
* @property {number} [installmentPrice] - Single installment price
*/
static propTypes = {
sellingPrice: PropTypes.number.isRequired,

Choose a reason for hiding this comment

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

propTypes geralmente ficam depois da classe e não precisam ser estáticas 😬

Pode ser assim:

Price.propTypes = { sellingPrice: PropTypes.number.isRequired, ... }

react/Price.js Outdated
<FormattedMessage id='pricing.from'/>
</div>
<div className='dib strike ph2'>
{ formatNumber(listPrice, currencyOptions) }

Choose a reason for hiding this comment

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

faltando indentação. Vcs usam lint e/ou prettier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ainda não estamos utilizando nenhum. Qual deveríamos usar e como configurar?

Choose a reason for hiding this comment

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

Tem um comando no CLI da VTEX para gerar uma configuração de lint vtex eslint local

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adicionei os dois

react/Price.js Outdated
@@ -0,0 +1,96 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl } from 'react-intl';

Choose a reason for hiding this comment

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

Importa também o intlShape para fazer a validação da prop intl.
intl: intlShape.isRequired

react/Price.js Outdated
<FormattedMessage id='pricing.from'/>
</div>
<div className='dib strike ph2'>
{ formatNumber(listPrice, currencyOptions) }

Choose a reason for hiding this comment

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

Tem um comando no CLI da VTEX para gerar uma configuração de lint vtex eslint local

@estacioneto estacioneto removed the request for review from brunojdo April 4, 2018 20:16
@brunojdo brunojdo added this to To do in Store Framework Apr 4, 2018
@brunojdo brunojdo moved this from To do to In progress in Store Framework Apr 4, 2018
@brunojdo brunojdo moved this from In progress to Done in Store Framework Apr 4, 2018
@brunojdo brunojdo moved this from Done to In progress in Store Framework Apr 4, 2018
@brunojdo brunojdo moved this from In progress to To do in Store Framework Apr 4, 2018
@brunojdo brunojdo moved this from To do to In progress in Store Framework Apr 4, 2018
@brunojdo brunojdo moved this from In progress to Done in Store Framework Apr 4, 2018
@brunojdo brunojdo removed this from Done in Store Framework Apr 4, 2018
pages/pages.json Outdated
"component": "Price",
"props": {
"showListPrice": true,
"listPrice": 120,

Choose a reason for hiding this comment

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

@brunojdo comentei com @estacioneto sobre esse código hard-coded. A gente costuma não aceitar nada assim aqui, mas também sei que o projeto está iniciando agora. O que acha? Sugeri deixar on hold enquanto a lógica não é implementada

Choose a reason for hiding this comment

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

mas você que decide 💯

Copy link
Contributor Author

@estacioneto estacioneto Apr 4, 2018

Choose a reason for hiding this comment

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

Além disso, este trecho é apenas para mostrar o componente funcionando como extension point na tela principal. Posso remover se preferir, @brunojdo . Removo esta parte e mostro pessoalmente o funcionamento

Copy link
Member

Choose a reason for hiding this comment

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

Concordo com @analuizamtg tem que tirar. Quando chegar eu vejo o funcionamento.

react/index.js Outdated
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types'
import {ExtensionPoint, Link, Helmet} from 'render'
import {FormattedMessage, FormattedHTMLMessage, injectIntl, intlShape} from 'react-intl'

Choose a reason for hiding this comment

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

Esse componente FormattedHTMLMessage está sendo usado em algum lugar?

Copy link
Member

Choose a reason for hiding this comment

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

Não achei também. Dá uma checada @estacioneto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Não. Removi. Apesar de que foi importado automaticamente pelo boilerplate do projeto.

pages/pages.json Outdated
"component": "Price",
"props": {
"showListPrice": true,
"listPrice": 120,
Copy link
Member

Choose a reason for hiding this comment

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

Concordo com @analuizamtg tem que tirar. Quando chegar eu vejo o funcionamento.

react/index.js Outdated
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types'
import {ExtensionPoint, Link, Helmet} from 'render'
import {FormattedMessage, FormattedHTMLMessage, injectIntl, intlShape} from 'react-intl'
Copy link
Member

Choose a reason for hiding this comment

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

Não achei também. Dá uma checada @estacioneto

react/Price.js Outdated
intl: intlShape.isRequired,
}

Price.schema = {
Copy link
Member

Choose a reason for hiding this comment

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

Quem tem schema é o Product Summary. Retirar

@estacioneto estacioneto merged commit 98f9e1d into master Apr 5, 2018
@brunojdo brunojdo deleted the feature/price-component branch April 23, 2018 18:01
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.

None yet

4 participants