- implementing immutable.js
This commit is contained in:
@@ -17,8 +17,15 @@ const AuctionPriceAndBidCount = ({ bidCount, currentPrice }) => {
|
||||
};
|
||||
|
||||
AuctionPriceAndBidCount.propTypes = {
|
||||
itemId: PropTypes.string.isRequired,
|
||||
bidCount: PropTypes.number.isRequired,
|
||||
currentPrice: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
currentPriceAndBidCount: {
|
||||
color: '#000',
|
||||
},
|
||||
});
|
||||
|
||||
export default AuctionPriceAndBidCount;
|
||||
|
||||
@@ -3,10 +3,10 @@ import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
StyleSheet,
|
||||
View,
|
||||
Text,
|
||||
} from 'react-native';
|
||||
|
||||
const BidStatus = ({ bidCount, currentPrice, isBidding, isWinning }) => {
|
||||
const BidStatus = ({ isBidding, isWinning }) => {
|
||||
if (!isBidding) {
|
||||
return null;
|
||||
}
|
||||
@@ -17,16 +17,16 @@ const BidStatus = ({ bidCount, currentPrice, isBidding, isWinning }) => {
|
||||
|
||||
return (
|
||||
<Text style={statusBarStyle} numberOfLines={1}>
|
||||
{`${currentPrice} (${bidCount} bids)`}
|
||||
{isWinning && `Oh no! You have been outbid!`}
|
||||
{!isWinning && isBidding && `You have the winning bid! (for now...)`}
|
||||
</Text>
|
||||
);
|
||||
};
|
||||
|
||||
BidStatus.propTypes = {
|
||||
bidCount: PropTypes.number.isRequired,
|
||||
currentPrice: PropTypes.number.isRequired,
|
||||
isBidding: PropTypes.bool.isRequired,
|
||||
isWinning: PropTypes.bool.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
||||
42
app/components/Auction/FilterBar.js
Normal file
42
app/components/Auction/FilterBar.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
const FilterBar = ({ changeFilterer, changeViewMode, filterMode, viewMode }) => (
|
||||
<View style={styles.filterBar}>
|
||||
<Text style={styles.filter}>Filter</Text>
|
||||
<Text style={styles.view}>View</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
FilterBar.propTypes = {
|
||||
changeFilterer: PropTypes.func.isRequired,
|
||||
changeViewMode: PropTypes.func.isRequired,
|
||||
filterMode: PropTypes.string,
|
||||
viewMode: PropTypes.string,
|
||||
};
|
||||
|
||||
FilterBar.defaultProps = {
|
||||
filterMode: null,
|
||||
viewMode: null,
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
filterBar: {
|
||||
backgroundColor: '#0F0',
|
||||
flexDirection: 'row',
|
||||
},
|
||||
filter: {
|
||||
flex: 2,
|
||||
},
|
||||
view: {
|
||||
flex: 2,
|
||||
},
|
||||
});
|
||||
|
||||
export default FilterBar;
|
||||
Reference in New Issue
Block a user