{"version":3,"sources":["pages/home/HomeElements.js","pages/home/Home.js","pages/Contact/ContactElements.js","pages/SubscribeandLogin/LoginElements.js","components/Comments.js","components/PostComment.js","components/BlogLay/BloglayElements.js","components/Recipes/RecipeElements.js","components/LoadingPage/LoadingElements.js","pages/SubscribeandLogin/Subscribe.js","pages/About/AboutElements.js","pages/About/littleme.webp","pages/About/About.js","components/Footer/FooterElements.js","components/BlogCard/BlogCardElements.js","components/BlogCard/BlogCard.js","components/Category/CategoryElements.js","pages/Post/PostElements.js","pages/Post/PostBlog.js","components/NewNav/NavElements.js","components/UniversalElements.js","App.js","reportWebVitals.js","components/Construction/UnderCElements.js","components/Construction/UnderConstruction.js","index.js"],"names":["styled","div","_templateObject","_taggedTemplateLiteral","Home","_templateObject2","h1","_templateObject3","_templateObject4","form","_templateObject5","button","_templateObject6","Comments","PostComment","img","_templateObject7","_templateObject8","_templateObject9","h3","p","Subscribe","About","LinkS","BlogCard","PostBlog","nav","App","reportWebVitals","onPerfEntry","Function","then","_ref","getCLS","getFID","getFCP","getLCP","getTTFB","ConstructionPage","ContentContainer","Content","UnderConstruction","_jsx","children","_jsxs","href","ReactDOM","render","React","StrictMode","BrowserRouter","document","getElementById"],"mappings":"0SAEuBA,IAAOC,IAAGC,MAAAC,YAAA,sC,MCqClBC,I,uCCrCoBJ,IAAOC,IAAGC,MAAAC,YAAA,sMAabH,IAAOC,IAAGI,MAAAF,YAAA,6HAUVH,IAAOM,GAAEC,MAAAJ,YAAA,4CAKZH,IAAOC,IAAGO,MAAAL,YAAA,4BAGnBH,IAAOS,KAAIC,MAAAP,YAAA,gEAOLH,IAAOW,OAAMC,MAAAT,YAAA,mFCrCRH,IAAOC,IAAGC,MAAAC,YAAA,gPAclBH,IAAOC,IAAGI,MAAAF,YAAA,4H,MCuClBU,I,OCkCAC,I,kCCxFiBd,IAAOC,IAAGC,MAAAC,YAAA,oFAOZH,IAAOC,IAAGI,MAAAF,YAAA,iEAOjBH,IAAOe,IAAGR,MAAAJ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P,SACbD,cAACD,GAAiB,QAItBU,SAASC,eAAe,SAM1BxB,O","file":"static/js/main.6b46be14.chunk.js","sourcesContent":["import styled from \"styled-components\";\n\nexport const HomeDiv = styled.div`\nbackground-color: white;\n\n`","import { useNavigate } from \"react-router-dom\";\n// import Carousel from \"../../components/Carousel/Carousel\";\nimport { useState,useEffect } from \"react\";\nimport { animateScroll as scroll } from 'react-scroll';\n// import BlogInfo from \"../../components/BlogInfo/BlogInfo\";\nimport { HomeDiv } from \"./HomeElements\";\n \n\nfunction Home ({search, currentUser, setSearch}) {\n const navigate = useNavigate()\n const [featuredPosts, setFeaturedPosts] = useState([])\n\n useEffect(() => {\n fetch(\"/blogs\")\n .then(res => res.json())\n .then(data => setFeaturedPosts(data))\n }, [])\n\n\n const featured = featuredPosts.filter((b) => b.featured === true)\n\n \n\n function getBlog(id){\n if (id){\n navigate(`/${id}`)\n }\n scroll.scrollToTop()\n }\n\n return (\n \n {/* \n */}\n \n \n )\n}\n\nexport default Home;","import styled from \"styled-components\";\n\nexport const ContactMeContainer = styled.div`\nwidth: 100%;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\npadding: 3%;\n\n@media screen and (max-width: 550px){\n // padding: 7% 0% 7% 0%;\n margin-top: 30px;\n}\n`\n\nexport const ContactMeContent = styled.div`\nwidth: 60%;\ndisplay: flex;\nflex-direction: column;\n\n@media screen and (max-width: 550px){\n width: 100%\n}\n`\n\nexport const ContactMeHeading = styled.h1`\nfont-weight: bold;\nfloat: left;\n`\n\nexport const FormContainer = styled.div`\nmax-width: 600px\n`\nexport const Form = styled.form`\ndisplay: flex;\nflex-direction: column;\ngap: 5px;\n\n`\n\nexport const SendButton = styled.button`\nmax-width: 20%;\nborder: none;\nbackground-color: black;\ncolor: white;\n`","import styled from \"styled-components\";\n\n\nexport const LoginContainer = styled.div`\nwidth: 100%;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\npadding: 10%;\nmin-height: 450px;\n\n@media screen and (max-width: 500px){\n padding: 7% 0% 7% 0%;\n margin-top: 30px;\n min-height: 320px;\n}\n` \nexport const Contain = styled.div`\nwidth: 40%;\nmax-width: 275px;\n\n@media screen and (max-width: 300px){\n padding: 5px;\n width: 100%\n}\n\n`\n","import { useEffect, useState } from \"react\";\n\nfunction Comments({c, currentUser, handleDelete}){\n const [user, setUser] = useState([])\n // const [likes, setLikes] = useState(c.likes)\n\n\n useEffect(() => {\n fetch(`/user/${c.user_id}`)\n .then(res => res.json())\n .then(data => setUser(data))\n },[])\n\n function deleteComment(){\n fetch(`comments/${c.id}`, {\n method: \"DELETE\",\n })\n handleDelete(c.id)\n }\n\n let me = \"angpace13@gmail.com\"\n\n // function likeComment(e){\n // e.preventDefault()\n // fetch(`comment/${c.id}`, {\n // method: \"PATCH\",\n // headers: { 'content-type': 'application/json' },\n // body: JSON.stringify({\n // likes: 0\n // })\n // })\n // .then(res => res.json())\n // }\n \n if(currentUser){\n if(currentUser.id === c.user_id || currentUser.email === me ){\n return
\n
\n

{user.name}

\n

{c.content}

\n \n
\n
\n }\n }\n \n return( \n
\n
\n

{user.name}

\n

{c.content}

\n
\n
\n )\n}\n\nexport default Comments;","import { useState } from 'react';\nimport { Link } from 'react-router-dom';\nimport toast, { Toaster } from 'react-hot-toast';\n\nfunction PostComment({currentUser, id, handleCommentUpdate}){\n const [comment, setComment] = useState({\n email: \"\",\n content: \"\",\n blog_id: id\n })\n\n\n\n function handleComment(e){\n const { name, value } = e.target \n setComment({...comment, [name]: value })\n }\n\n function submitComment(e){\n e.preventDefault()\n fetch(\"/comments\", {\n method: \"POST\",\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n content: comment.content,\n blog_id: id,\n user_id: currentUser.id\n })\n })\n .then(res => res.json())\n .then(data => handleCommentUpdate(data))\n toast.success(\"Thank you for your comment!\")\n e.target.reset()\n\n }\n\n return (\n <>\n \n {currentUser? \n\n
\n
\n
\n \n \n
\n \n \n
\n
\n \n :\n
\n
\n
\n
\n
\n \n \n
\n Go to login →\n
\n
}\n \n )\n}\n\nexport default PostComment;","import styled from \"styled-components\";\n\nexport const BlogLayContainer = styled.div`\nbackground-color: white;\nwidth: 100%;\nmargin: auto;\nmargin-top: 26px;\n`\n\nexport const FeatureContain = styled.div`\nwidth: 100%;\noverflow: hidden;\nmax-height: 300px;\n\n`\n\nexport const Feature = styled.img`\n width: 100%; /* Make the image 90% of the container's width */\n /* max-height: 350px; Set the maximum height of the image */\n object-fit: cover;\n /* border-radius: 15px; */\n`\nexport const BlogContent = styled.div`\nmargin: auto;\nwidth: 80%;\nmax-width: 900px;\n\n@media screen and (max-width: 600px) {\n width: 90%\n}\n`\n\nexport const BlogTitle = styled.h1`\nfont-size: 60px;\npadding-top: 5%;\npadding-bottom: 3%;\n\n@media screen and (max-width: 600px) {\n font-size: 30px;\n}\n`\nexport const SecondImgContainer = styled.div`\ndisplay: flex;\njustify-content: center;\noverflow: hidden;\nmax-height: 300px;\n`\nexport const SecondImage = styled.img`\nwidth: 85%;\npadding: 2%;\nobject-fit: cover;\n\n`\n\nexport const ButtonContainer = styled.div`\npadding-bottom: 10%;\n\n@media screen and (max-width: 440px){\n padding-bottom: 15%; \n}\n`\n\nexport const JumpToRecipe = styled.button`\nfloat: right;\n`\n\n\n","import styled from \"styled-components\";\n\nexport const RecipeContainer = styled.div`\nmargin-top: 10%;\npadding-top: 10%;\n/* border: thin solid; */\npadding: 5%;\n\n\n@media screen and (max-width: 440px){\n padding-top: 15%;\n}\n`\nexport const MiniTitle = styled.h3`\npadding-top: 5%;\n`\n\nexport const RecipeImageContainer = styled.div`\ndisplay: flex;\nflex-direction: column;\njustify-content: center;\nalign-items: center;\npadding-top: 7%;\n\n/* border: thin solid; */\n`\n\nexport const RecipeImage = styled.img`\nheight: 200px;\nwidth: 200px;\nborder-radius: 50%;\n`\nexport const RecipeTitle = styled.p`\nfont-size: 22px;\n\n`\n\nexport const RecipeInformation = styled.div`\ndisplay: flex;\nflex-direction: row;\njustify-content: center;\n/* justify-content: space-around */\n\n@media screen and (max-width: 440px){\n flex-direction: column;\n}\n\n`\nexport const RecipeDetails = styled.p`\npadding-right: 5%\n`","import styled from \"styled-components\";\n\nexport const SpinnerContainer = styled.div`\nmargin-top: 70px;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\npadding: 15%;\njustify-content: space-around;\n`","import { useState } from \"react\";\nimport toast, { Toaster } from 'react-hot-toast';\nimport { useNavigate } from \"react-router-dom\";\nimport {Form} from \"../Contact/ContactElements\";\nimport { Contain, LoginContainer } from \"./LoginElements\";\n\nfunction Subscribe(){\n const nav = useNavigate()\n const [subscriber, setSubscriber] = useState({\n name: \"\",\n email: \"\",\n password: \"\",\n })\n\n\n function handleChange(e){\n const {name, value} = e.target\n setSubscriber({...subscriber, [name]: value})\n \n }\n \n function handleSubscription(e){\n e.preventDefault()\n fetch('/users', {\n method: \"POST\",\n headers: { 'content-type': 'application/json'},\n body: JSON.stringify({\n name: subscriber.name,\n email: subscriber.email,\n password: subscriber.password\n }) \n })\n .then(res => {\n if (res.status === 200){\n res.json()\n .then(data => console.log(data))\n toast.success(\"Thanks for subscribing!\")\n nav(\"/login\")\n } else if (res.status === 422){\n res.json()\n .then(data => toast.error(data.error[0]))\n }\n })\n e.target.reset();\n }\n\n return(\n \n \n
\n

Thank you for your interest in Kitchen and Code!

\n

Sign up to receive email updates for new blog posts.

\n
\n \n
\n \n \n \n \n \n
\n
\n )\n}\n\nexport default Subscribe;","import styled from \"styled-components\";\n\nexport const AboutContainer = styled.div`\npadding: 10%;\ndisplay: flex;\njustify-content: space-between;\nmax-height: 650px;\nmax-width: 1600px;\nalign-items: center;\n\n@media screen and (max-width: 600px) {\n flex-direction: column;\n margin-top: 30px;\n max-height: 100%;\n}\n`\n\nexport const Image = styled.img`\nwidth: 40%;\nmax-width: 400px;\n/* height: 40% */\n\n@media screen and (max-width: 600px) {\n width: 100%\n}\n`\nexport const AboutMeContent = styled.div`\nwidth: 50%;\nfloat: right;\n\n@media screen and (max-width: 600px) {\n width: 100%\n}\n`\nexport const Content = styled.div`\ndisplay: flex;\nflex-direction: column;\n`\nexport const Title = styled.h3`\nfont-weight: 600px\n`\nexport const Body = styled.p`\n`","export default __webpack_public_path__ + \"static/media/littleme.fc7f35ad.webp\";","import { AboutContainer, Image, AboutMeContent, Content, Title, Body} from \"./AboutElements\";\nimport littleme from './littleme.webp'\n\nfunction About () {\n\n return (\n \n \n \n About\n Kitchen and Code is a collaboration of some of my many passions, food, technology and sharing knowledge about these topics. Before becoming a Software Engineer, \n I worked as a Pastry Chef in Michelin-starred restaurants around the world. Even before that, I grew up in an Italian household that always seemed to revolve around food. My passion for technology came later in life, when it replaced food as the \"glue\" that kept my family close.\n Hospitality and Technology have many things in common, among the most important to me is bringing people together.\n I'm Angela Pace and I hope you'll join me in this journey, exploring all things Kitchen and Code.\n
\n
\n Currently: Product & Data Analyst at Loyalist, Specialist at Apple\n \n
\n
\n \n
\n )\n}\n\nexport default About;","import { Link as LinkS } from \"react-router-dom\";\nimport styled from \"styled-components\";\n\nexport const FooterFlex = styled.div`\nmax-height: 200px;\n/* border-top: thin solid; */\n\n/* max-width: 1100px; */\n\n@media screen and (max-width: 400px){\n /* max-height: 100px; */\n}\n\n`\n\nexport const FooterContent = styled.div`\npadding: 5%;\ndisplay: flex;\njustify-content: space-around;\nbackground-color: rgba(225,232,238,0.95);\n/* background-color: #e8e8ed; */\n\n@media screen and (max-width: 820px){\n flex-direction: column;\n}\n`\nexport const FooterTitle = styled.p`\nfont-weight: 600;\npadding-top: 6px;\ncolor: #333333;\n`\n\nexport const FooterLinks = styled.div`\ndisplay: flex;\nflex-direction: column;\n/* align-items: center; */\n`\n\nexport const Link = styled(LinkS)`\ntext-decoration: none;\ncolor: #333333;\n\n&:hover{\n color: gray;\n transition: 0.3s ease-out\n}\n`\nexport const SocialMediaWrap = styled.div`\ndisplay: flex;\ngap: 8%;\nalign-items: center;\nmax-width: 1100px;\n\n@media screen and (max-width: 820px){\n padding-top: 2%;\n gap: 3%;\n}\n`\n\n","import styled from \"styled-components\";\n\nexport const Container = styled.div`\nbox-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 15px 0 rgba(0, 0, 0, 0.19);background-color: white;\n/* border: thin solid; */\n/* border-color: rgba(233,188,68,0.9808517156862745); */\nborder-radius: 20px;\n\n&:hover{\n cursor: pointer;\n}\n\n`\n\nexport const BlogCardContainer = styled.div`\nmax-width: 90%;\nmargin: auto;\n\n@media screen and (max-width: 500px){\n max-width: 100%;\n}\n`\nexport const CardTitle = styled.h3`\nfont-weight: 200;\n\n@media screen and (max-width: 400px){\n font-weight: 300px;\n font-size: 18px;\n}\n\n`\nexport const TitleandDate= styled.div`\ndisplay: flex;\njustify-content: space-between;\npadding-top: 1%;\n\n@media screen and (max-width: 600px){\n flex-direction: column;\n padding-left: 4%;\n font-size: 14px;\n}\n\n`\nexport const CardDate = styled.p`\nfont-size: 15px;\n@media screen and (max-width: 600px){\n font-size: 13px;\n}\n\n`\nexport const CardPreview = styled.p`\n\n@media screen and (max-width: 600px){\n padding-left: 4%;\n padding-right: 2%;\n font-size: 13px;\n}\n`\nexport const CardLikes = styled.p`\ncolor: gray; \nfont-size: 10px;\npadding-bottom: 3%;\n/* font-style: italic; */\n@media screen and (max-width: 600px){\n padding-left: 3%\n}\n`\n\nexport const ImgContainer = styled.div`\npadding-top: 4%;\noverflow: hidden;\nmax-height: 250px;\ndisplay: flex;\n justify-content: center;\n \n`\n\nexport const CardImage = styled.img`\n width: 100%; /* Make the image 90% of the container's width */\n max-height: 350px; /* Set the maximum height of the image */\n object-fit: cover;\n border-radius: 20px;\n /* border: thin solid; */\n\n @media screen and (max-width: 500px){\n width: 90%;\n \n}\n`","import { useState } from \"react\";\nimport { useNavigate} from \"react-router-dom\";\nimport { animateScroll as scroll } from 'react-scroll';\nimport { BlogCardContainer, CardDate, CardTitle, CardPreview, CardLikes, Container, ImgContainer, CardImage, TitleandDate } from \"./BlogCardElements\";\n\nfunction BlogCard ({b, currentUser, handleDelete, rerender}) {\n const navigate = useNavigate();\n const [edit, setEdit] = useState(false)\n // const [editForm, setEditForm] = useState({})\n const [postRecipe, setPostRecipe] = useState(false)\n const [recipe, setRecipe] = useState({\n title: \"\",\n ingredients: [],\n method: [],\n blog_id: b.id,\n photo: \"\",\n time: \"\",\n servings: 0,\n })\n \n function getBlogPost (b) {\n scroll.scrollToTop();\n navigate(`/${b.id}`)\n }\n\n function deletePost (e){\n e.preventDefault()\n fetch(`blogs/${b.id}`, {\n method: \"DELETE\",\n })\n handleDelete(b.id)\n }\n\n function handleChange(e) {\n const { name, value } = e.target \n if (name === \"ingredients\" || name === \"method\") {\n const valueArray = value.split(\"\\n\").filter((str) => str.trim() !== \"\");\n setRecipe({ ...recipe, [name]: valueArray });\n } else {\n setRecipe({ ...recipe, [name]: value });\n }\n }\n\n function handleSubmit(e) {\n e.preventDefault()\n fetch('/recipes', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n title: recipe.title,\n ingredients: recipe.ingredients,\n blog_id: b.id,\n method: recipe.method,\n photo: recipe.photo,\n time: recipe.time,\n servings: recipe.servings\n })\n })\n .then(r => {\n if (r.status === 200){\n r.json()\n .then(data => rerender(data))\n }\n else if (r.status === 422) {\n r.json()\n .then(data => console.log(data.error))\n }}\n )\n }\n\n let me = currentUser && currentUser.email === \"angpace13@gmail.com\"\n\n return (\n \n \n \n {me?\n
\n \n \n \n
\n :\n <>\n }\n {postRecipe? \n\n
\n
\n \n \n \n \n \n \n \n \n
\n\n :\n\n <>\n\n }\n getBlogPost(b)}>\n \n \n \n \n {b.title}\n {b.date}\n \n {b.preview}\n {b.likes} ❤️\n \n \n
\n \n \n \n \n )\n}\n\nexport default BlogCard;","import styled from \"styled-components\";\n\nexport const CategoryPage = styled.div`\nwidth: 80%;\nmargin: auto;\nmargin-top: 40px;\npadding-bottom: 5%;\n\n@media screen and (max-width: 600px){\n width: 100%;\n}\n`\n\nexport const CategoryHeading = styled.h1`\npadding-top: 5%;\n\n@media screen and (max-width: 600px){\n padding-left: 5%;\n}\n`\n\nexport const CardHolder = styled.div`\ndisplay: flex;\nflex-direction: column;\npadding-top: 20px;\nwidth:60%;\ngap: 10px;\n\n@media screen and (max-width: 700px){\n margin: auto;\n width: 90%;\n}\n\n`","import styled from \"styled-components\";\n\nexport const PostContainer = styled.div`\ndisplay: flex;\nflex-direction: column;\nmax-width: 80%;\nmargin: auto;\nmargin-top: 30px;\n\n`\nexport const Form = styled.form`\npadding-bottom: 7%;\ndisplay: flex;\nflex-direction: column;\nwidth: 90%;\nmargin: auto;\n`\n\n","import { useState, useRef } from 'react';\nimport toast, { Toaster } from 'react-hot-toast';\nimport { PostContainer, Form } from './PostElements';\n\nfunction PostBlog ({currentUser}) {\n const form = useRef()\n const [newPost, setNewPost] = useState({\n title: \"\",\n preview: \"\",\n paragraph_one: \"\",\n paragraph_two: \"\",\n paragraph_three: \"\",\n date: \"\",\n feature: \"\",\n image_one: \"\",\n category: \"\",\n featured: \"\",\n keywords: \"\"\n })\n \n\n\n function handleChange(e) {\n const { name, value } = e.target \n setNewPost({ ...newPost, [name]: value })\n }\n\n \n\n function handleSubmit(e) {\n e.preventDefault()\n fetch('/blogs', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n title: newPost.title,\n user_id: currentUser.id,\n preview: newPost.preview,\n paragraph_one: newPost.paragraph_one,\n paragraph_two: newPost.paragraph_two,\n paragraph_three: newPost.paragraph_three,\n date: newPost.date,\n feature: newPost.feature,\n image_one: newPost.image_one,\n category: newPost.category,\n featured: newPost.featured,\n keywords: newPost.keywords,\n likes: 0\n })\n })\n .then(r => {\n if (r.status === 200){\n r.json()\n .then(data => console.log(data))\n .then(toast.success(\"Blog posted successfully\"))\n }\n else if (r.status === 422) {\n r.json()\n .then(data => console.log(data.error))\n }}\n )\n }\n \n\n return (\n \n \n \n

Post a New Blog

\n
\n \n \n \n \n \n \n \n \n