diff --git a/js/components/IconButton.js b/js/components/IconButton.js new file mode 100644 index 0000000..bd3d78e --- /dev/null +++ b/js/components/IconButton.js @@ -0,0 +1,17 @@ +// @flow +import React from 'react'; +import { Text, View } from 'react-native'; +import { pure } from 'recompose'; +import { Link } from 'react-router-native'; +import { Icon } from 'react-native-material-ui'; + +export default pure(({ glyph, text, route }: { glyph: string, text: string, route: string }) => ( + + + + + {text} + + + +)); diff --git a/js/components/ImageBackdrop.js b/js/components/ImageBackdrop.js new file mode 100644 index 0000000..edd9fd3 --- /dev/null +++ b/js/components/ImageBackdrop.js @@ -0,0 +1,10 @@ +// @flow +import React from 'react'; +import { View, Image } from 'react-native'; +import { pure } from 'recompose'; + +export default pure(({ uri }: { uri?: string }) => ( + + + +)); diff --git a/js/components/ImageThumb.js b/js/components/ImageThumb.js new file mode 100644 index 0000000..84dfe09 --- /dev/null +++ b/js/components/ImageThumb.js @@ -0,0 +1,10 @@ +// @flow +import React from 'react'; +import { View, Image } from 'react-native'; +import { pure } from 'recompose'; + +export default pure(({ uri, style }: { uri: string, style?: Object }) => ( + + + +)); diff --git a/js/components/ItemTile.js b/js/components/ItemTile.js index 0eab58c..4b5adaf 100644 --- a/js/components/ItemTile.js +++ b/js/components/ItemTile.js @@ -21,8 +21,8 @@ export const Thumbnail = ({ thumb }: { thumb: ?string }) => ( ); -export const NameAndPlace = ({ name, place }: { name: string, place: string }) => ( - +export const NameAndPlace = ({ name, place, style }: { name: string, place: string, style: Object }) => ( + {name} {place} @@ -38,7 +38,7 @@ export const PlaceTile = pure(({ place }: { place: Place, onPress: Function }) = - + )); @@ -47,7 +47,7 @@ export const FoodItemTile = pure(({ foodItem }: { foodItem: FoodItem, onPress: F - + diff --git a/js/helpers/QuantityHelpers.js b/js/helpers/QuantityHelpers.js new file mode 100644 index 0000000..5027449 --- /dev/null +++ b/js/helpers/QuantityHelpers.js @@ -0,0 +1,16 @@ +// @flow + +export type Quantity = 'none' | 'few' | 'many'; + +export const getQuantityText = (quantity: Quantity) => { + switch (quantity) { + case 'none': + return 'None Left'; + case 'few': + return 'Few Left'; + case 'many': + return 'Many Left'; + default: + return 'Many Left'; + } +}; diff --git a/js/pages/FoodItemDetail.js b/js/pages/FoodItemDetail.js index 85503ca..ee7b39b 100644 --- a/js/pages/FoodItemDetail.js +++ b/js/pages/FoodItemDetail.js @@ -2,8 +2,19 @@ import React, { Component } from 'react'; import { Text, View } from 'react-native'; import theme from '../ui-theme'; +import { NameAndPlace } from '../components/ItemTile'; // import { type FoodItem } from '../records/FoodItemRecord'; import { compose, pure } from 'recompose'; +import ImageThumb from '../components/ImageThumb'; +import ImageBackdrop from '../components/ImageBackdrop'; +import IconButton from '../components/IconButton'; +import { type Quantity, getQuantityText } from '../helpers/QuantityHelpers'; + +const QuantityText = pure(({ quantity }: { quantity: Quantity }) => ( + + {getQuantityText(quantity)} + +)); export class FoodItemDetail extends Component { static displayName = 'FoodItemDetail'; @@ -18,10 +29,26 @@ export class FoodItemDetail extends Component { // todo: need to get the item from the stream by this id render() { - const { match: { params: { id } } } = this.props; return ( - {id} + + + + + + + + + + + + + + + + + + ); } diff --git a/js/pages/List.js b/js/pages/List.js index 1ab8c5b..36ec14f 100644 --- a/js/pages/List.js +++ b/js/pages/List.js @@ -8,7 +8,7 @@ import { type RoutingContextFlowTypes, routingContextPropTypes } from '../routes const tabs = ['food', 'places']; -const getTabIndex = (tabName: string) => tabs.findIndex(tabName); +const getTabIndex = (tabName: string) => tabs.indexOf(tabName); const getTabName = (index: number) => tabs[index]; diff --git a/js/records/FoodItemRecord.js b/js/records/FoodItemRecord.js index d6d8ce6..8687cea 100644 --- a/js/records/FoodItemRecord.js +++ b/js/records/FoodItemRecord.js @@ -7,7 +7,8 @@ export type FoodItem = { placeId: ?number, availableCount: number, images: List, - thumb: string, + thumbImage: ?string, + titleImage: ?string, }; const FoodRecordDefaults: FoodItem = { @@ -16,7 +17,8 @@ const FoodRecordDefaults: FoodItem = { placeId: null, availableCount: 0, images: List(), - thumb: '', + thumbImage: '', + titleImage: '', }; export default Record(FoodRecordDefaults, 'FoodItemRecord'); diff --git a/js/streams/FoodItemsStream.js b/js/streams/FoodItemsStream.js index 505542f..6186b34 100644 --- a/js/streams/FoodItemsStream.js +++ b/js/streams/FoodItemsStream.js @@ -10,6 +10,15 @@ const DUMMY_DATA = [ id: 1, name: 'Big John Cookies', placeId: 1, + images: [ + 'https://s-media-cache-ak0.pinimg.com/564x/e7/5f/08/e75f08b00c0bc7f2b01b3d1a636389f6.jpg', + 'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg', + 'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg', + 'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg', + 'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg', + ], + thumbImage: 'http://images.media-allrecipes.com/userphotos/560x315/1107530.jpg', + titleImage: 'https://s-media-cache-ak0.pinimg.com/564x/e7/5f/08/e75f08b00c0bc7f2b01b3d1a636389f6.jpg', }, { id: 2, diff --git a/js/ui-theme.js b/js/ui-theme.js index 49db486..23cc61f 100644 --- a/js/ui-theme.js +++ b/js/ui-theme.js @@ -36,7 +36,7 @@ export default { thumbnailSize: 50, thumbnailColor: COLOR.grey500, itemNameStyle: { - color: COLOR.grey500, + color: COLOR.grey800, }, itemPlaceStyle: { color: COLOR.grey500,