-
Notifications
You must be signed in to change notification settings - Fork 0
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
Coupons page #1
Coupons page #1
Conversation
src/component/CouponRow.js
Outdated
let merchant = null; | ||
let icon = null; | ||
|
||
switch (this.props.category) { |
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.
Instead of switch
, I think you can create a Map of <Category, icon>.
Something like:
const icons = {
'Cinema' : require();
}
And use it as icons[this.props.category]
directly.
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.
Thinking to the future, probably the single coupon will have a categoryId, not the full name.
I think we can move the map inside a common/categories.js
, with name and icon (still using the name as key for now) file and use it where we need.
import PropTypes from 'prop-types'; | ||
import * as Constants from '../common/constants'; | ||
|
||
export default class CouponHeader extends Component { |
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.
CouponHeader should receive only the quantity of coupons. Then it should define the text logic (zero, one, more than one).
src/screen/Coupons.js
Outdated
return ( | ||
<FlatList | ||
ListHeaderComponent={() => ( | ||
<CouponHeader |
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.
As commented above, it should be something like
<CouponHeader activeCoupons={4} />
src/screen/Coupons.js
Outdated
let headerTextStart, | ||
headerTextQuantity = '1 buono', | ||
headerTextEnd = ' ancora da spendere'; | ||
if (headerTextQuantity == '1 buono') { |
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.
You should only use the number of coupons, not comparing strings.
Get unused coupons with filter/length over coupons
array.
de3e31b
to
69669f2
Compare
7531eee
to
4ec0785
Compare
I'm working on Coupons Page. I managed the coupon row and coupon list for coupon used and not.