-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add recipes search bundle, and wire into recipes search UI
- Loading branch information
1 parent
621722f
commit b652941
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import createAsyncResourceBundle from 'lib/createAsyncResourceBundle'; | ||
import { Recipe } from 'types/Recipe'; | ||
|
||
type RecipesState = Recipe[]; | ||
|
||
export const { actions, reducer, selectors } = | ||
createAsyncResourceBundle<RecipesState>('recipes', { | ||
indexById: true, | ||
// Add stub data in the absence of proper search data. | ||
initialData: [ | ||
{ | ||
id: 'example-recipe', | ||
featuredImage: { | ||
url: 'https://media.guim.co.uk/7f96c515c4e320b8ded848f23ffdef8bd311fcad/245_1381_2750_2751/2000.jpg', | ||
mediaId: '7f96c515c4e320b8ded848f23ffdef8bd311fcad', | ||
cropId: '', | ||
source: 'The Guardian. Food stylist: Loic Parisot.', | ||
photographer: 'Robert Billington', | ||
caption: | ||
'Felicity Cloake’s Thai green curry works with chicken, seafood, pork, beef or tofu.', | ||
mediaApiUri: '', | ||
width: 2000, | ||
height: 2000, | ||
}, | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export type RecipeImage = { | ||
url: string; | ||
mediaId?: string; | ||
cropId?: string; | ||
source?: string; | ||
photographer?: string; | ||
imageType?: string; | ||
caption?: string; | ||
mediaApiUri?: string; | ||
displayCredit?: boolean; | ||
width?: number; | ||
height?: number; | ||
}; | ||
|
||
// Incomplete – add as we need more properties. Eventually, this would | ||
// be useful to derive from a package. | ||
export type Recipe = { | ||
id: string; | ||
featuredImage: RecipeImage; // the latter is an old image format that appears in our test fixtures | ||
previewImage?: RecipeImage; | ||
}; |