Created
October 16, 2017 02:33
-
-
Save MoonTahoe/fa8393602432db426063286c82709899 to your computer and use it in GitHub Desktop.
Server Render Recipes Start Files
This file contains hidden or 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
Show hidden characters
{ | |
"presets": [ | |
"env", | |
"stage-0", | |
"react" | |
] | |
} |
This file contains hidden or 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
import React from 'react' | |
export const Menu = ({ recipes }) => | |
<article> | |
<header> | |
<h1>Delicious Recipes</h1> | |
</header> | |
<div className="recipes"> | |
{ recipes.map((recipe, i) => | |
<Recipe key={i} {...recipe} />) | |
} | |
</div> | |
</article> | |
export const Recipe = ({ name, ingredients, steps}) => | |
<section id={name.toLowerCase().replace(/ /g, '-')}> | |
<h1>{name}</h1> | |
<IngredientsList list={ingredients} /> | |
<Instructions title="Cooking Instructions" | |
steps={steps} /> | |
</section> | |
export const Instructions = ({ title, steps }) => | |
<section className="instructions"> | |
<h2>{title}</h2> | |
{steps.map((s, i) => | |
<p key={i}>{s}</p> | |
)} | |
</section> | |
export const IngredientsList = ({ list }) => | |
<ul className="ingredients"> | |
{list.map((ingredient, i) => | |
<Ingredient key={i} {...ingredient} /> | |
)} | |
</ul> | |
export const Ingredient = ({ amount, measurement, name }) => | |
<li> | |
<span className="amount">{amount} </span> | |
<span className="measurement">{measurement} </span> | |
<span className="name">{name}</span> | |
</li> |
This file contains hidden or 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
[ | |
{ | |
"name": "Baked Salmon", | |
"ingredients": [ | |
{ "name": "Salmon", "amount": 1, "measurement": "l lb" }, | |
{ "name": "Pine Nuts", "amount": 1, "measurement": "cup" }, | |
{ "name": "Butter Lettuce", "amount": 2, "measurement": "cups" }, | |
{ "name": "Yellow Tail Squash", "amount": 1, "measurement": "med" }, | |
{ "name": "Olive Oil", "amount": 0.5, "measurement": "cup" }, | |
{ "name": "Garlic", "amount": 3, "measurement": "cloves" } | |
], | |
"steps": [ | |
"Preheat the oven to 350 degrees.", | |
"Spread the olive oil around a glass baking dish.", | |
"Add the salmon, Garlic, and pine nuts to the dish", | |
"Bake for 15 minutes.", | |
"Add the Butternut Squash and put back in the oven for 30 mins.", | |
"Remove from oven and let cool for 15 minutes. Add the lettuce and serve." | |
] | |
}, | |
{ | |
"name": "Fish Tacos", | |
"ingredients": [ | |
{ "name": "Whitefish", "amount": 1, "measurement": "l lb" }, | |
{ "name": "cheese", "amount": 1, "measurement": "cup" }, | |
{ "name": "Iceberg Lettuce", "amount": 2, "measurement": "cups" }, | |
{ "name": "Tomatoes", "amount": 2, "measurement": "large"}, | |
{ "name": "Tortillas", "amount": 3, "measurement": "med" } | |
], | |
"steps": [ | |
"Cook the Fish on the Grill until Hot", | |
"Place the fish on the 3 tortillas", | |
"Top them with lettuce, tomatoes, and cheese" | |
] | |
} | |
] |
This file contains hidden or 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
var webpack = require("webpack") | |
var path = require("path") | |
process.noDeprecation = true | |
module.exports = { | |
entry: "./src/index.js", | |
output: { | |
path: path.join(__dirname, 'assets'), | |
filename: "bundle.js" | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /(node_modules)/, | |
loader: 'babel-loader', | |
query: { | |
presets: ['env', 'stage-0', 'react'] | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment