forked from bewildergeist/awp-spring-2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bewildergeist#1 from kattata/Issue#3
Tailwind styling
- Loading branch information
Showing
21 changed files
with
1,135 additions
and
5,942 deletions.
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
/build | ||
/public/build | ||
.env | ||
/app/tailwind.css |
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 |
---|---|---|
@@ -1,19 +1,91 @@ | ||
{ | ||
"posts": [ | ||
"recipes": [ | ||
{ | ||
"id": "1", | ||
"title": "Post 1", | ||
"body": "This is test post #1" | ||
"title": "Spaghetti", | ||
"body": "This is test post #1", | ||
"seperatedIngredients": [ | ||
"apples", | ||
" cinamon", | ||
" dough" | ||
], | ||
"author": "Kasia", | ||
"img": "https://ocdn.eu/pulscms-transforms/1/iGxk9kpTURBXy8wYTQ2YmY1M2NlYTVlMTM2NWU2MjdiMmRjODExZTUxZi5qcGeTlQMAH80D6M0CMpMJpjA2NTMzYgaTBc0EsM0CdoGhMAE/spaghetti-puttanesca.jpg" | ||
}, | ||
{ | ||
"id": "2", | ||
"title": "Post 2", | ||
"body": "This is test post #2" | ||
"title": "Muffins", | ||
"body": "This is test post #2", | ||
"seperatedIngredients": [ | ||
"flour", | ||
" eggs", | ||
" milk", | ||
"chocolate" | ||
], | ||
"author": "Kasia", | ||
"img": "https://www.valdemarsro.dk/wp-content/2021/01/vaniljemuffins.jpg" | ||
}, | ||
{ | ||
"id": "3", | ||
"title": "Post 3", | ||
"body": "This is test post #3" | ||
"title": "Tomato Soup", | ||
"body": "This soup is everything I want tomato soup to be! It’s rich and creamy, yet doesn’t weigh me down. It’s bursting with amazing tomato flavor, yet it’s made from canned tomatoes.", | ||
"seperatedIngredients": [ | ||
"tomatos", | ||
" peper", | ||
" salt", | ||
"onion", | ||
"olive oil" | ||
], | ||
"author": "Kasia", | ||
"img": "https://images.unsplash.com/photo-1547592166-23ac45744acd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1171&q=80" | ||
}, | ||
{ | ||
"id": "17f259f2ef0", | ||
"title": "Lasagne", | ||
"body": "This is lasagne", | ||
"seperatedIngredients": [ | ||
"tomatos", | ||
" lasagne pasta", | ||
" meat" | ||
], | ||
"author": "Magda", | ||
"img": "https://images.unsplash.com/photo-1614961909013-1e2212a2ca87?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1887&q=80" | ||
}, | ||
{ | ||
"id": "17f25a5e53a", | ||
"title": "Apple pie", | ||
"body": "Apple pie", | ||
"seperatedIngredients": [ | ||
"apples", | ||
" cinamon", | ||
" dough" | ||
], | ||
"author": "Magda", | ||
"img": "https://images.unsplash.com/photo-1587248720327-8eb72564be1e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1887&q=80" | ||
}, | ||
{ | ||
"id": "17f25e97ee3", | ||
"title": "Curry Ramen", | ||
"body": "Curry", | ||
"seperatedIngredients": [ | ||
"ramen pasta", | ||
" curry", | ||
" coconut milk" | ||
], | ||
"author": "Magda", | ||
"img": "https://www.kwestiasmaku.com/sites/v123.kwestiasmaku.com/files/curry_ramen_01.jpg" | ||
}, | ||
{ | ||
"id": "17f2653bdd0", | ||
"title": "Sandwich", | ||
"body": "This is a sandwich hihihihiihihi", | ||
"seperatedIngredients": [ | ||
"bread", | ||
" lettuce", | ||
" cheese" | ||
], | ||
"author": "Kasia", | ||
"img": "https://assets.epicurious.com/photos/5d3770225c5cb8000935d1db/6:4/w_3272,h_2181,c_limit/crispy-green-goddess-sandwich-recipe-BA-071119.jpg" | ||
} | ||
] | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export default function Home() { | ||
return ( | ||
<div> | ||
<h1>Welcome</h1> | ||
<p>This site is full of great posts. Enjoy!</p> | ||
<h1>Welcome to our Recipes Blog</h1> | ||
<p>This site is full of great recipes. Enjoy! By Kasia&Magda</p> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 3 additions & 1 deletion
4
lesson-04/remix-site/app/routes/posts.jsx → lesson-04/remix-site/app/routes/recipes.jsx
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,74 @@ | ||
import { Link, redirect } from "remix"; | ||
import { useLoaderData } from "remix"; | ||
import db from "~/db/db.server"; | ||
import RecipeStylesUrl from "~/styles/Recipe.css"; | ||
|
||
export const loader = async function ({ params }) { | ||
const recipe = db.data.recipes.find((p) => p.id === params.recipeId); | ||
|
||
if (!recipe) { | ||
throw new Error("recipe not found"); | ||
} | ||
return { | ||
recipe, | ||
}; | ||
}; | ||
|
||
export const action = async function ({ request, params }) { | ||
const form = await request.formData(); | ||
if (form.get("_method") === "delete") { | ||
db.data.recipes = db.data.recipes.filter((p) => p.id !== params.recipeId); | ||
db.write(); | ||
return redirect("/recipes"); | ||
} | ||
}; | ||
|
||
export function links() { | ||
return [ | ||
{ | ||
rel: "stylesheet", | ||
href: RecipeStylesUrl, | ||
}, | ||
]; | ||
} | ||
|
||
export default function Recipe() { | ||
const { recipe } = useLoaderData(); | ||
|
||
return ( | ||
<div> | ||
<div className="page-header"> | ||
<h1>{recipe.title}</h1> | ||
<Link to=".." className="btn btn-reverse"> | ||
Back | ||
</Link> | ||
</div> | ||
<div className="recipe-content"> | ||
<img src={recipe.img} ></img> | ||
<div className="recipe-info"> | ||
<h2>Description</h2> | ||
<p className="page-content">{recipe.body}</p> | ||
<h2>Ingredients</h2> | ||
<ul className="page-content"> | ||
{recipe.seperatedIngredients.map((ingredient) => { | ||
return ( | ||
<li> | ||
{ingredient} | ||
</li> | ||
) | ||
})}</ul> | ||
<h2>Author</h2> | ||
<p className="page-content">{recipe.author}</p> | ||
</div> | ||
</div> | ||
<div className="page-footer"> | ||
<form method="post"> | ||
<input type="hidden" name="_method" value="delete" /> | ||
<button type="submit" className="btn btn-delete"> | ||
Delete | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.