From 41c5000561d54599fbdaa81905e533c4d11c565c Mon Sep 17 00:00:00 2001 From: yesim Date: Sun, 21 Aug 2022 15:19:20 +0300 Subject: [PATCH 1/2] feat: tr added --- next-i18next.config.js | 2 +- public/locales/ar/common.json | 3 -- public/locales/en/addmeal.json | 16 ++++++ public/locales/en/cards.json | 7 +++ public/locales/en/create-account.json | 19 +++++++ public/locales/en/edit-account.json | 7 +++ public/locales/en/footer.json | 11 ++++ public/locales/en/hero.json | 6 +++ public/locales/en/landing-meals.json | 6 +++ public/locales/en/navbar.json | 10 ++++ public/locales/en/order.json | 25 +++++++++ public/locales/en/profile.json | 8 +++ public/locales/en/search-cities.json | 5 ++ public/locales/tr/addmeal.json | 14 ++++++ public/locales/tr/cards.json | 7 +++ public/locales/tr/create-account.json | 18 +++++++ public/locales/tr/edit-account.json | 7 +++ public/locales/tr/footer.json | 11 ++++ public/locales/tr/hero.json | 6 +++ public/locales/tr/landing-meals.json | 7 +++ public/locales/tr/navbar.json | 10 ++++ public/locales/tr/order.json | 26 ++++++++++ public/locales/tr/profile.json | 8 +++ public/locales/tr/search-cities.json | 5 ++ src/components/AddMeal/AddMeal.jsx | 34 ++++++++----- src/components/Cards/Cards.jsx | 15 +++--- src/components/EditAccount/EditAccount.jsx | 13 +++-- src/components/Footer/Footer.jsx | 20 ++++---- src/components/Hero/Hero.jsx | 14 +++--- src/components/LandingMeals/LandingMeals.jsx | 8 ++- src/components/Navbar/Navbar.jsx | 16 +++--- src/components/Orders/Orders.jsx | 53 +++++++++++--------- src/components/Profile/Profile.jsx | 15 +++--- src/components/SearchCities/SearchCities.js | 14 +++--- src/components/SignUpForm/SignUpForm.jsx | 33 ++++++------ src/pages/index.jsx | 20 ++++++-- 36 files changed, 388 insertions(+), 111 deletions(-) delete mode 100644 public/locales/ar/common.json create mode 100644 public/locales/en/addmeal.json create mode 100644 public/locales/en/cards.json create mode 100644 public/locales/en/create-account.json create mode 100644 public/locales/en/edit-account.json create mode 100644 public/locales/en/footer.json create mode 100644 public/locales/en/hero.json create mode 100644 public/locales/en/landing-meals.json create mode 100644 public/locales/en/navbar.json create mode 100644 public/locales/en/order.json create mode 100644 public/locales/en/profile.json create mode 100644 public/locales/en/search-cities.json create mode 100644 public/locales/tr/addmeal.json create mode 100644 public/locales/tr/cards.json create mode 100644 public/locales/tr/create-account.json create mode 100644 public/locales/tr/edit-account.json create mode 100644 public/locales/tr/footer.json create mode 100644 public/locales/tr/hero.json create mode 100644 public/locales/tr/landing-meals.json create mode 100644 public/locales/tr/navbar.json create mode 100644 public/locales/tr/order.json create mode 100644 public/locales/tr/profile.json create mode 100644 public/locales/tr/search-cities.json diff --git a/next-i18next.config.js b/next-i18next.config.js index 2380ae7..83ed78d 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -1,6 +1,6 @@ module.exports = { i18n: { defaultLocale: "en", - locales: ["en", "ar", "tr"], + locales: ["en", "tr"], }, }; diff --git a/public/locales/ar/common.json b/public/locales/ar/common.json deleted file mode 100644 index e089509..0000000 --- a/public/locales/ar/common.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "test": "مرحبا" -} diff --git a/public/locales/en/addmeal.json b/public/locales/en/addmeal.json new file mode 100644 index 0000000..b7505ce --- /dev/null +++ b/public/locales/en/addmeal.json @@ -0,0 +1,16 @@ +{ + "fried-chips": "Fried Chips", + "dietary": "Dietary", + "vegeterian":"Vegetarian", + "vegan": "Vegan", + "gluten-free":"Gluten free", + "ingredients": "Ingredients", + "tomatoes": "Tomatoes", + "delivery": "Delivery in", + "price": "Price", + "howmuch": "$30", + "time":"30 min", + "save": "Save" + + +} \ No newline at end of file diff --git a/public/locales/en/cards.json b/public/locales/en/cards.json new file mode 100644 index 0000000..db5f59a --- /dev/null +++ b/public/locales/en/cards.json @@ -0,0 +1,7 @@ +{ + "card-title": "You've missed homemade food?", + "card-subtitle": "Pick your favorite chef, food or cuisine.", + "card1-text": "order the food and get it when you want", + "card2-text": "Get a 15% discount for your first order!", + "card2-btn": "Order Now" +} diff --git a/public/locales/en/create-account.json b/public/locales/en/create-account.json new file mode 100644 index 0000000..1c1b237 --- /dev/null +++ b/public/locales/en/create-account.json @@ -0,0 +1,19 @@ +{ + "create-account": "Create an Account", + "firstname": "First Name", + "lastname": "Last Name", + "password":"Password", + "email": "Email", + "area-code": "Area Code", + "phone": "Phone Number", + "adress":"Adress", + "zip-code": "ZIP Code", + "city": "City", + "country": "Country", + "terms-conditions": "I agree to Terms and Conditions ", + "cancel": "Cancel", + "have-account": "Already Have An Account?", + "register-btn": "Register", + "signin":"Sign In" + +} \ No newline at end of file diff --git a/public/locales/en/edit-account.json b/public/locales/en/edit-account.json new file mode 100644 index 0000000..21b27ac --- /dev/null +++ b/public/locales/en/edit-account.json @@ -0,0 +1,7 @@ +{ + "account": "Edit Account", + "phone-num": "Phone Number", + "old-password": "Old Password", + "new-password": "New Password", + "save-btn": "Save" +} \ No newline at end of file diff --git a/public/locales/en/footer.json b/public/locales/en/footer.json new file mode 100644 index 0000000..80d5b29 --- /dev/null +++ b/public/locales/en/footer.json @@ -0,0 +1,11 @@ +{ + "help": "Get help", + "chef": "Become a chef", + "promotions": "Promotions", + "about": "About Cookiez", + "chef-around": " Chefs near me", + "view-foods": "View all home made foods", + "view-cities": "View all cities", + "view-chefs": "View all chefs", + "copyright": "Cookiez Copyright 2022" +} \ No newline at end of file diff --git a/public/locales/en/hero.json b/public/locales/en/hero.json new file mode 100644 index 0000000..d25d65a --- /dev/null +++ b/public/locales/en/hero.json @@ -0,0 +1,6 @@ +{ + "title": " Fast delivery, delicious and cheaper", + "subtitle": "Find your favorite food and order in seconds", + "placeholder": "Enter a food name or location", + "search-button": "Find" +} \ No newline at end of file diff --git a/public/locales/en/landing-meals.json b/public/locales/en/landing-meals.json new file mode 100644 index 0000000..7317514 --- /dev/null +++ b/public/locales/en/landing-meals.json @@ -0,0 +1,6 @@ +{ + "search": "Search", + "categories": "Categories", + "spanish-paella": "Spanish Paella", + "price": "$6" +} diff --git a/public/locales/en/navbar.json b/public/locales/en/navbar.json new file mode 100644 index 0000000..38a043e --- /dev/null +++ b/public/locales/en/navbar.json @@ -0,0 +1,10 @@ +{ + "signup": "Sign Up", + "login": "Login", + "add-new-food":" Add a new food", + "dashboard": "Dashboard", + "account-settings": "Account Settings", + "logout": "Logout", + "name": "{{name}}" + +} \ No newline at end of file diff --git a/public/locales/en/order.json b/public/locales/en/order.json new file mode 100644 index 0000000..7718e48 --- /dev/null +++ b/public/locales/en/order.json @@ -0,0 +1,25 @@ +{ + + "orders": "Orders", + "settings": "Payment settings", + "reviews": "Customer reviews", + "total": "Total orders", + "revenue": "Revenue", + "popular": "Popular orders", + "filter": "Filter", + "search": "Search by food name", + "date-btn": "Date range", + "status-btn": "Status", + "payment-btn": "Payment method", + "ref": "Ref.", + "date": "DATE", + "customer": "CUSTOMER", + "food": "FOOD", + "status": "STATUS", + "payment": "PAYMENT", + "price": "PRICE", + "fried-chips":"Fried Chips", + "sausage": "Sausage", + "preparing":"Preparing", + "credit-card":"Credit Card" +} \ No newline at end of file diff --git a/public/locales/en/profile.json b/public/locales/en/profile.json new file mode 100644 index 0000000..02d6743 --- /dev/null +++ b/public/locales/en/profile.json @@ -0,0 +1,8 @@ +{ + "profile":"Profile", + "listed-foods": "Listed foods", + "orders": "Orders", + "payment-settings":"Payment settings", + "edit-profile":"Edit profile", + "logout":"Logout" +} \ No newline at end of file diff --git a/public/locales/en/search-cities.json b/public/locales/en/search-cities.json new file mode 100644 index 0000000..9a87fa5 --- /dev/null +++ b/public/locales/en/search-cities.json @@ -0,0 +1,5 @@ +{ + "title": "Places where Cookiez is available", + "text": "We are currently providing services for limited cities. We plan to expand services across whole country very soon.Enter a city name", + "placeholder": "Enter a city name" +} \ No newline at end of file diff --git a/public/locales/tr/addmeal.json b/public/locales/tr/addmeal.json new file mode 100644 index 0000000..906b1ef --- /dev/null +++ b/public/locales/tr/addmeal.json @@ -0,0 +1,14 @@ +{ + "fried-chips": "Kızarmış Patates", + "dietary": "Diyet", + "vegeterian": "Vejeteryan", + "vegan": "Vegan", + "gluten-free": "Glutensiz", + "ingredients": "Malzemeler", + "tomatoes": "Domates", + "delivery": "Teslimat", + "price": "Fiyat", + "howmuch": "3 tl", + "time": "30 dk", + "save": "Kaydet" +} diff --git a/public/locales/tr/cards.json b/public/locales/tr/cards.json new file mode 100644 index 0000000..7d27149 --- /dev/null +++ b/public/locales/tr/cards.json @@ -0,0 +1,7 @@ +{ + "card-title": "Ev yapımı yemekleri özlemedin mi?", + "card-subtitle": "Favori şefini, yemeğini veya mutfağını seç", + "card1-text": "Şefini seç ,yemeğini sipariş et ve anında kapında olsun", + "card2-text": "İlk siparişinde %15 indirimi kap!", + "card2-btn": "Sipariş Ver" +} diff --git a/public/locales/tr/create-account.json b/public/locales/tr/create-account.json new file mode 100644 index 0000000..eebbd5c --- /dev/null +++ b/public/locales/tr/create-account.json @@ -0,0 +1,18 @@ +{ + "create-account": "Hesap Oluştur", + "firstname": "İsim", + "lastname": "Soyisim", + "password": "Şifre", + "email": "Mail Adresi", + "adress": "Adres", + "area-code": "Alan Kodu", + "phone": "Telefon Numarası", + "zip-code": "Posta Kodu", + "city": "Şehir", + "country": "Ülke", + "terms-conditions": "Hüküm ve Koşulları kabul ediyorum ", + "cancel": "İptal", + "have-account": "Hesabın Var Mı?", + "register-btn": "Kayıt Ol", + "signin": "Giriş Yap" +} diff --git a/public/locales/tr/edit-account.json b/public/locales/tr/edit-account.json new file mode 100644 index 0000000..c0c283c --- /dev/null +++ b/public/locales/tr/edit-account.json @@ -0,0 +1,7 @@ +{ + "account": "Hesap Yenileme", + "phone-num": "Telefon Numarası", + "old-password": "Eski Şifre", + "new-password": "Yeni Şifre", + "save-btn": "Kaydet" +} \ No newline at end of file diff --git a/public/locales/tr/footer.json b/public/locales/tr/footer.json new file mode 100644 index 0000000..351ac91 --- /dev/null +++ b/public/locales/tr/footer.json @@ -0,0 +1,11 @@ +{ + "help": "Yardım al", + "chef": "Şef ol", + "promotions": "Promosyonlar", + "about": "Cookiez hakkında", + "chef-around": "Yakınlarımdaki şefler ", + "view-foods": "Tüm ev yapımı yemekleri görüntüle", + "view-cities": "Tüm şehirleri görüntüle", + "view-chefs": "Tüm şefleri görüntüle", + "copyright": "Cookiez Copyright 2022" +} diff --git a/public/locales/tr/hero.json b/public/locales/tr/hero.json new file mode 100644 index 0000000..0259bb9 --- /dev/null +++ b/public/locales/tr/hero.json @@ -0,0 +1,6 @@ +{ + "title": "Lezzetli, ucuz ve hızlı teslimat", + "subtitle": "Favori yemeğini bul ve saniyeler içinde sipariş et", + "placeholder": "Yemek ismi veya konumunu gir", + "search-button": "Ara" +} diff --git a/public/locales/tr/landing-meals.json b/public/locales/tr/landing-meals.json new file mode 100644 index 0000000..fde8b05 --- /dev/null +++ b/public/locales/tr/landing-meals.json @@ -0,0 +1,7 @@ +{ + "search": "Ara", + "categories":"Kategoriler", + "spanish-paella": "İspanyol Paella", + "price": "60 tl" + +} \ No newline at end of file diff --git a/public/locales/tr/navbar.json b/public/locales/tr/navbar.json new file mode 100644 index 0000000..ecf4aed --- /dev/null +++ b/public/locales/tr/navbar.json @@ -0,0 +1,10 @@ +{ + "signup": "Kayıt OL", + "login": "Giriş Yap", + "add-new-food":" Yeni Yemek Ekle", + "dashboard": "Profil", + "account-settings": "Hesap Ayarları", + "logout": "Çıkış", + "name": "{{isim}}" + +} \ No newline at end of file diff --git a/public/locales/tr/order.json b/public/locales/tr/order.json new file mode 100644 index 0000000..66631b6 --- /dev/null +++ b/public/locales/tr/order.json @@ -0,0 +1,26 @@ +{ + + "orders": "Siparişler", + "payment-settings": "Ödeme ayarları", + "customer-reviews": "Müşteri yorumları", + "logout": "Çıkış", + "total": "Toplam siparişler", + "revenue": "Kazanç", + "popular": "Popüler siparişler", + "filter": "Filtrele", + "search": "Yemek ismiyle ara", + "date-btn": "Tarih aralığı", + "status-btn": "Sipariş durumu", + "payment-btn": "Ödeme yöntemi", + "ref": "Referans", + "date": "Tarih", + "customer": "Müşteri", + "food": "Yemek", + "status": "Sipariş durumu", + "payment": "Ödeme", + "price": "Fiyat", + "fried-chips":"Kızarmış Patates", + "sausage": "Sosis", + "preparing":"Hazırlanıyor", + "credit-card":"Kredi Kartı" + } \ No newline at end of file diff --git a/public/locales/tr/profile.json b/public/locales/tr/profile.json new file mode 100644 index 0000000..73854dd --- /dev/null +++ b/public/locales/tr/profile.json @@ -0,0 +1,8 @@ +{ + "profile":"Profil", + "listed-foods": "Listelenmiş Yemekler", + "orders": "Siparişler", + "payment-settings":"Ödeme Ayarları", + "edit-profile":"Profili Düzenle", + "logout":"Çıkış" +} \ No newline at end of file diff --git a/public/locales/tr/search-cities.json b/public/locales/tr/search-cities.json new file mode 100644 index 0000000..6f1f604 --- /dev/null +++ b/public/locales/tr/search-cities.json @@ -0,0 +1,5 @@ +{ + "title": "Cookiez'in hizmet verdiği yerler", + "text": "Şuan sınırlı şehirde hizmet veriyoruz. Yakında tüm ülkede hizmet vermeyi planlıyoruz.", + "placeholder": "Bir şehir ismi gir" +} diff --git a/src/components/AddMeal/AddMeal.jsx b/src/components/AddMeal/AddMeal.jsx index 96d76b0..5ea1680 100644 --- a/src/components/AddMeal/AddMeal.jsx +++ b/src/components/AddMeal/AddMeal.jsx @@ -1,6 +1,8 @@ +import { useTranslation } from "next-i18next"; import { useState } from "react"; import { HiPlusCircle } from "react-icons/hi"; import { IoAddCircleOutline, IoTrashBinOutline } from "react-icons/io5"; + export default function AddMeal() { const [mealImage, setMealImage] = useState("../images/header.jpg"); const [mealName, setMealName] = useState(""); @@ -37,6 +39,8 @@ export default function AddMeal() { isGlutenFree(!glutenFree); glutenFree ? setDietary([...dietary, "gluten free"]) : null; } + const { t } = useTranslation("addmeal"); + return (
-

Dietary

+

{t("dietary")}

  • -
    Vegetarian
    +
    + {t("vegeterian")} +
  • @@ -120,7 +126,7 @@ export default function AddMeal() { className='inline-flex w-full cursor-pointer items-center justify-between rounded-full bg-[#00494533] p-1 ring-1 ring-[#00494533] peer-checked:ring-[#004945]' >
    -
    Vegan
    +
    {t("vegan")}
    @@ -136,18 +142,20 @@ export default function AddMeal() { className='inline-flex w-full cursor-pointer items-center justify-between rounded-full bg-[#00494533] p-1 ring-1 ring-[#00494533] peer-checked:ring-[#004945]' >
    -
    Gluten Free
    +
    + {t("gluten-free")} +
-

Ingredients

+

{t("ingredients")}

setIngredient(e.target.value)} @@ -173,19 +181,21 @@ export default function AddMeal() { ))}
-

Delivery in

+

{t("delivery")}

setDeliveryMin(e.target.value)} > -

Price

+

{t("price")}

setPrice(e.target.value)} > @@ -195,7 +205,7 @@ export default function AddMeal() { }} className=' absolute bottom-80 right-0 mr-2 rounded bg-[#004945] px-6 py-1 text-white' > - Save + {t("save")}
); diff --git a/src/components/Cards/Cards.jsx b/src/components/Cards/Cards.jsx index c0d7dc2..78dc7d0 100644 --- a/src/components/Cards/Cards.jsx +++ b/src/components/Cards/Cards.jsx @@ -1,15 +1,19 @@ import Image from "next/image"; +import { useTranslation } from "next-i18next"; + const Cards = () => { + const { t } = useTranslation("cards"); + return (
{/* title part */}

- You’ve missed home made food? + {t("card-title")}

- Pick your favorite chef, food or cousin. + {t("card-subtitle")}

@@ -26,8 +30,7 @@ const Cards = () => { />
- Pick your chef order the food and get it when - you want + {t("card1-text")}
{

- Get a 15% discount for your first order! + {t("card2-text")}{" "}

diff --git a/src/components/EditAccount/EditAccount.jsx b/src/components/EditAccount/EditAccount.jsx index ccccf09..640423e 100644 --- a/src/components/EditAccount/EditAccount.jsx +++ b/src/components/EditAccount/EditAccount.jsx @@ -1,4 +1,5 @@ import Image from "next/image"; +import { useTranslation } from "next-i18next"; import { useState } from "react"; import { BiUserCircle } from "react-icons/bi"; @@ -7,6 +8,8 @@ export default function EditAccount() { const [oldPass, setOldPass] = useState(""); const [newPass, setNewPass] = useState(""); + const { t } = useTranslation("edit-account"); + // return EditPage component return ( <> @@ -15,7 +18,7 @@ export default function EditAccount() { {/* icon */}
-

Edit Your Account

+

{t("account")}

{/* image, fields */} @@ -38,7 +41,7 @@ export default function EditAccount() { className='rounded border text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='phoneNum' type='text' - placeholder='Phone Number' + placeholder={t("phone-num")} value={phoneNum} onChange={(event) => setPhoneNum(event.target.value) @@ -49,7 +52,7 @@ export default function EditAccount() { className='rounded border text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='oldPass' type='password' - placeholder='Old Password' + placeholder={t("old-password")} value={oldPass} onChange={(event) => setOldPass(event.target.value) @@ -60,7 +63,7 @@ export default function EditAccount() { className='rounded border text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='newPass' type='password' - placeholder='New Password' + placeholder={t("new-password")} value={newPass} onChange={(event) => setNewPass(event.target.value) @@ -68,7 +71,7 @@ export default function EditAccount() { /> {/* save button */}
diff --git a/src/components/Footer/Footer.jsx b/src/components/Footer/Footer.jsx index 09f33e4..80dc5de 100644 --- a/src/components/Footer/Footer.jsx +++ b/src/components/Footer/Footer.jsx @@ -1,7 +1,9 @@ import Link from "next/link"; +import { useTranslation } from "next-i18next"; import { BsFacebook, BsInstagram, BsTwitter } from "react-icons/bs"; const Footer = () => { + const { t } = useTranslation("footer"); return ( <>
- Cookiez Copyright 2022 + {t("copyright")}
diff --git a/src/components/Hero/Hero.jsx b/src/components/Hero/Hero.jsx index 9dbd1d5..0c46fe8 100644 --- a/src/components/Hero/Hero.jsx +++ b/src/components/Hero/Hero.jsx @@ -1,18 +1,18 @@ +import { useTranslation } from "next-i18next"; import { useEffect, useState } from "react"; function Hero() { const [search, setSearch] = useState(""); + const { t } = useTranslation("hero"); - useEffect(() => { - console.log(search); - }, [search]); + useEffect(() => {}, [search]); return (

- Fast delivery, delicious and cheaper + {t("title")}

@@ -21,19 +21,19 @@ function Hero() { setSearch(e.target.value)} value={search} />
- Find your favorite home made food and order in seconds + {t("subtitle")}
diff --git a/src/components/LandingMeals/LandingMeals.jsx b/src/components/LandingMeals/LandingMeals.jsx index 8876b61..51ba6bf 100644 --- a/src/components/LandingMeals/LandingMeals.jsx +++ b/src/components/LandingMeals/LandingMeals.jsx @@ -1,5 +1,9 @@ import Image from "next/image"; +import { useTranslation } from "next-i18next"; + const LandingMeals = () => { + const { t } = useTranslation("landing-meals"); + return (
@@ -9,12 +13,12 @@ const LandingMeals = () => {

- Categories + {t("categories")}

  • item 1
  • diff --git a/src/components/Navbar/Navbar.jsx b/src/components/Navbar/Navbar.jsx index 27f6e82..e53a12b 100644 --- a/src/components/Navbar/Navbar.jsx +++ b/src/components/Navbar/Navbar.jsx @@ -1,11 +1,13 @@ import { Menu } from "@headlessui/react"; import Image from "next/image"; import Link from "next/link"; +import { useTranslation } from "next-i18next"; import { useState } from "react"; function Navbar() { // this is a temporary state, when we apply login auth. this will be replaced with actual state const [loggedIn, setLoggedIn] = useState(false); + const { t } = useTranslation("navbar"); return ( <> @@ -52,7 +54,7 @@ function Navbar() { + {" "} - Add a new food + {t("add-new-food")} )} @@ -65,7 +67,7 @@ function Navbar() { : "text-gray-900" } text-m group flex w-full items-center rounded-[10px] px-2 py-2 font-sans`} > - Dashboard + {t("dashboard")} )} @@ -78,7 +80,7 @@ function Navbar() { : "text-gray-900" } text-m group flex w-full items-center rounded-[10px] px-2 py-2 font-sans`} > - Account Settings + {t("account-settings")} )} @@ -92,7 +94,7 @@ function Navbar() { : "text-gray-900" } text-m group flex w-full items-center rounded-[10px] px-2 py-2 font-sans`} > - Logout + {t("logout")} )} @@ -105,8 +107,10 @@ function Navbar() {
  • /
  • -
  • Login
  • -
  • Sign up
  • +
  • + {t("login")} +
  • +
  • {t("signup")}
)} diff --git a/src/components/Orders/Orders.jsx b/src/components/Orders/Orders.jsx index f158516..5ff0417 100644 --- a/src/components/Orders/Orders.jsx +++ b/src/components/Orders/Orders.jsx @@ -1,3 +1,4 @@ +import { useTranslation } from "next-i18next"; import { BiCalendar, BiNotepad, @@ -7,17 +8,19 @@ import { } from "react-icons/bi"; const Orders = () => { + const { t } = useTranslation("order"); + return (
-

Orders

+

{t("orders")}

- Total orders + {t("total")}

135 @@ -25,7 +28,7 @@ const Orders = () => {

- Revenue + {t("revenue")}

450$ @@ -33,40 +36,40 @@ const Orders = () => {

- Popular Order + {t("popular")}

- Fried Chips + {t("fried-chips")}

-

Filter

+

{t("filter")}

-

Search by food name

+

{t("search")}

-

Date range

+

{t("date-btn")}

-

Status

+

{t("status-btn")}

-

Payment Method

+

{t("payment-btn")}

-

DATE

-

CUSTOMER

-

FOOD

-

STATUS

-

PAYMENT

-

PRICE

+

{t("date")}

+

{t("customer")}

+

{t("food")}

+

{t("status")}

+

{t("payment")}

+

{t("price")}

@@ -77,13 +80,13 @@ const Orders = () => {

Brad Pitt

-

Sausage

+

{t("sausage")}

-

Preparing

+

{t("preparing")}

-

Credit Card

+

{t("credit-card")}

5

@@ -98,13 +101,13 @@ const Orders = () => {

Brad Pitt

-

Sausage

+

{t("sausage")}

-

Preparing

+

{t("preparing")}

-

Credit Card

+

{t("credit-card")}

5

@@ -119,13 +122,13 @@ const Orders = () => {

Brad Pitt

-

Sausage

+

{t("sausage")}

-

Preparing

+

{t("preparing")}

-

Credit Card

+

{t("credit-card")}

5

diff --git a/src/components/Profile/Profile.jsx b/src/components/Profile/Profile.jsx index fe1793e..41ba419 100644 --- a/src/components/Profile/Profile.jsx +++ b/src/components/Profile/Profile.jsx @@ -1,6 +1,9 @@ import Link from "next/link"; +import { useTranslation } from "next-i18next"; function Profile({ children }) { + const { t } = useTranslation("profile"); + return (
@@ -15,7 +18,7 @@ function Profile({ children }) {
- Profile + {t("profile")}
@@ -31,27 +34,27 @@ function Profile({ children }) { diff --git a/src/components/SearchCities/SearchCities.js b/src/components/SearchCities/SearchCities.js index 773144f..0aae8f2 100644 --- a/src/components/SearchCities/SearchCities.js +++ b/src/components/SearchCities/SearchCities.js @@ -1,17 +1,15 @@ +import { useTranslation } from "next-i18next"; import { useState } from "react"; const SearchCities = () => { + const { t } = useTranslation("search-cities"); + const [city, setCity] = useState(""); return (
-

- Places where Cookiez is available -

-

- We are currently providing services for limited cities. We - plan to expand services across whole country very soon. -

+

{t("title")}

+

{t("text")}

@@ -19,7 +17,7 @@ const SearchCities = () => { setCity(e.target.value)} required diff --git a/src/components/SignUpForm/SignUpForm.jsx b/src/components/SignUpForm/SignUpForm.jsx index 48400b1..2837c2f 100644 --- a/src/components/SignUpForm/SignUpForm.jsx +++ b/src/components/SignUpForm/SignUpForm.jsx @@ -1,7 +1,10 @@ import Image from "next/image"; +import { useTranslation } from "next-i18next"; import { useState } from "react"; export default function SignUpForm() { + const { t } = useTranslation("create-account"); + const [formData, setFormData] = useState({ firstName: "", lastName: "", @@ -38,7 +41,7 @@ export default function SignUpForm() { {/* form container */}

- Create An Account + {t("create-account")}

handleFormData(e)} required @@ -60,7 +63,7 @@ export default function SignUpForm() { className='w-full appearance-none rounded border py-2 px-3 text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='lastName' type='text' - placeholder='Last Name' + placeholder={t("lastname")} value={formData.lastName} onChange={(e) => handleFormData(e)} required @@ -70,7 +73,7 @@ export default function SignUpForm() { className='w-full appearance-none rounded border py-2 px-3 text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='password' type='password' - placeholder='Password' + placeholder={t("password")} value={formData.password} onChange={(e) => handleFormData(e)} required @@ -80,7 +83,7 @@ export default function SignUpForm() { className='w-full appearance-none rounded border py-2 px-3 text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='email' type='email' - placeholder='Email' + placeholder={t("email")} value={formData.email} onChange={(e) => handleFormData(e)} required @@ -91,7 +94,7 @@ export default function SignUpForm() { id='phone' type='tel' pattern='[0-9]{10}' - placeholder='Phone Number' + placeholder={t("phone")} value={formData.phone} onChange={(e) => handleFormData(e)} required @@ -101,7 +104,7 @@ export default function SignUpForm() { className='w-full appearance-none rounded border py-2 px-3 text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='address' type='text' - placeholder='Address' + placeholder={t("adress")} value={formData.address} onChange={(e) => handleFormData(e)} required @@ -112,7 +115,7 @@ export default function SignUpForm() { className='w-full appearance-none rounded border py-2 px-3 text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='city' type='text' - placeholder='City' + placeholder={t("city")} value={formData.city} onChange={(e) => handleFormData(e)} required @@ -122,7 +125,7 @@ export default function SignUpForm() { className='w-full appearance-none rounded border py-2 px-3 text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none' id='country' type='text' - placeholder='Country' + placeholder={t("country")} value={formData.country} onChange={(e) => handleFormData(e)} required @@ -136,26 +139,24 @@ export default function SignUpForm() { onClick={(e) => handleFormData(e)} required /> - - I agree to Terms and Conditions - + {t("terms-conditions")} {/* submit button */} {/* cancel button */} {/* sign in redirecting */}
- Already Have An Account?{" "} + {t("have-account")}{" "} - Sign in + {t("signin")}
diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 0b47859..94a965c 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -1,20 +1,19 @@ -import { useTranslation } from "next-i18next"; import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import * as React from "react"; import Cards from "@/components/Cards/Cards"; import Hero from "@/components/Hero/Hero"; +import LandingMeals from "@/components/LandingMeals/LandingMeals"; import Layout from "@/components/Layout/Layout"; import SearchCities from "@/components/SearchCities/SearchCities"; -export default function HomePage() { - // eslint-disable-next-line - const { t } = useTranslation("common"); +export default function HomePage() { return ( + ); } @@ -22,7 +21,18 @@ export default function HomePage() { export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale, ["common"])), + ...(await serverSideTranslations(locale, [ + "hero", + "cards", + "search-cities", + "footer", + "addmeal", + "navbar", + "create-account", + "edit-account", + "profile", + "landing-meals", + ])), // Will be passed to the page component as props }, }; From 7e60ea100c708698ee1512b6f174646c920d5d1d Mon Sep 17 00:00:00 2001 From: yesim Date: Sun, 21 Aug 2022 15:49:17 +0300 Subject: [PATCH 2/2] feat: tests are added --- public/locales/en/addmeal.json | 28 +- public/locales/en/create-account.json | 35 +- public/locales/en/edit-account.json | 12 +- public/locales/en/footer.json | 20 +- public/locales/en/hero.json | 10 +- public/locales/en/landing-meals.json | 2 +- public/locales/en/navbar.json | 17 +- public/locales/en/order.json | 47 ++- public/locales/en/profile.json | 14 +- public/locales/en/search-cities.json | 8 +- public/locales/tr/cards.json | 10 +- public/locales/tr/edit-account.json | 12 +- public/locales/tr/landing-meals.json | 11 +- public/locales/tr/navbar.json | 17 +- public/locales/tr/order.json | 49 ++- public/locales/tr/profile.json | 14 +- .../AddMeal/{__test__ => }/AddMeal.test.jsx | 7 +- .../__snapshots__/AddMeal.test.jsx.snap | 29 +- .../Cards/{__test__ => }/Cards.test.jsx | 4 +- .../__snapshots__/Cards.test.jsx.snap | 13 +- .../{__test__ => }/EditAccount.test.jsx | 7 +- .../__snapshots__/EditAccount.test.jsx.snap | 12 +- src/components/Footer/Footer.test.jsx | 11 + .../Footer/__snapshots__/Footer.test.jsx.snap | 199 ++++++++++ .../Hero/__snapshots__/Hero.test.jsx.snap | 42 +- .../__snapshots__/LandingMeals.test.jsx.snap | 4 +- src/components/Layout/Layout.test.jsx | 11 + .../Layout/__snapshots__/Layout.test.jsx.snap | 363 ++++++++++++++++++ .../Navbar/__snapshots__/Navbar.test.jsx.snap | 2 +- .../Orders/{__test__ => }/Orders.test.jsx | 4 +- .../__snapshots__/Orders.test.jsx.snap | 58 +-- .../{__test__ => }/SearchCities.test.jsx | 6 +- .../__snapshots__/SearchCities.test.jsx.snap | 8 +- .../{__test__ => }/SignUpForm.test.jsx | 5 +- .../__snapshots__/SignUpForm.test.jsx.snap | 32 +- 35 files changed, 853 insertions(+), 270 deletions(-) rename src/components/AddMeal/{__test__ => }/AddMeal.test.jsx (56%) rename src/components/AddMeal/{__test__ => }/__snapshots__/AddMeal.test.jsx.snap (94%) rename src/components/Cards/{__test__ => }/Cards.test.jsx (74%) rename src/components/Cards/{__test__ => }/__snapshots__/Cards.test.jsx.snap (98%) rename src/components/EditAccount/{__test__ => }/EditAccount.test.jsx (54%) rename src/components/EditAccount/{__test__ => }/__snapshots__/EditAccount.test.jsx.snap (96%) create mode 100644 src/components/Footer/Footer.test.jsx create mode 100644 src/components/Footer/__snapshots__/Footer.test.jsx.snap create mode 100644 src/components/Layout/Layout.test.jsx create mode 100644 src/components/Layout/__snapshots__/Layout.test.jsx.snap rename src/components/Orders/{__test__ => }/Orders.test.jsx (78%) rename src/components/Orders/{__test__ => }/__snapshots__/Orders.test.jsx.snap (93%) rename src/components/SearchCities/{__test__ => }/SearchCities.test.jsx (65%) rename src/components/SearchCities/{__test__ => }/__snapshots__/SearchCities.test.jsx.snap (76%) rename src/components/SignUpForm/{__test__ => }/SignUpForm.test.jsx (68%) rename src/components/SignUpForm/{__test__ => }/__snapshots__/SignUpForm.test.jsx.snap (93%) diff --git a/public/locales/en/addmeal.json b/public/locales/en/addmeal.json index b7505ce..876c70c 100644 --- a/public/locales/en/addmeal.json +++ b/public/locales/en/addmeal.json @@ -1,16 +1,14 @@ { - "fried-chips": "Fried Chips", - "dietary": "Dietary", - "vegeterian":"Vegetarian", - "vegan": "Vegan", - "gluten-free":"Gluten free", - "ingredients": "Ingredients", - "tomatoes": "Tomatoes", - "delivery": "Delivery in", - "price": "Price", - "howmuch": "$30", - "time":"30 min", - "save": "Save" - - -} \ No newline at end of file + "fried-chips": "Fried Chips", + "dietary": "Dietary", + "vegeterian": "Vegetarian", + "vegan": "Vegan", + "gluten-free": "Gluten free", + "ingredients": "Ingredients", + "tomatoes": "Tomatoes", + "delivery": "Delivery in", + "price": "Price", + "howmuch": "$30", + "time": "30 min", + "save": "Save" +} diff --git a/public/locales/en/create-account.json b/public/locales/en/create-account.json index 1c1b237..4ee292e 100644 --- a/public/locales/en/create-account.json +++ b/public/locales/en/create-account.json @@ -1,19 +1,18 @@ { - "create-account": "Create an Account", - "firstname": "First Name", - "lastname": "Last Name", - "password":"Password", - "email": "Email", - "area-code": "Area Code", - "phone": "Phone Number", - "adress":"Adress", - "zip-code": "ZIP Code", - "city": "City", - "country": "Country", - "terms-conditions": "I agree to Terms and Conditions ", - "cancel": "Cancel", - "have-account": "Already Have An Account?", - "register-btn": "Register", - "signin":"Sign In" - -} \ No newline at end of file + "create-account": "Create an Account", + "firstname": "First Name", + "lastname": "Last Name", + "password": "Password", + "email": "Email", + "area-code": "Area Code", + "phone": "Phone Number", + "adress": "Adress", + "zip-code": "ZIP Code", + "city": "City", + "country": "Country", + "terms-conditions": "I agree to Terms and Conditions ", + "cancel": "Cancel", + "have-account": "Already Have An Account?", + "register-btn": "Register", + "signin": "Sign In" +} diff --git a/public/locales/en/edit-account.json b/public/locales/en/edit-account.json index 21b27ac..2519a43 100644 --- a/public/locales/en/edit-account.json +++ b/public/locales/en/edit-account.json @@ -1,7 +1,7 @@ { - "account": "Edit Account", - "phone-num": "Phone Number", - "old-password": "Old Password", - "new-password": "New Password", - "save-btn": "Save" -} \ No newline at end of file + "account": "Edit Account", + "phone-num": "Phone Number", + "old-password": "Old Password", + "new-password": "New Password", + "save-btn": "Save" +} diff --git a/public/locales/en/footer.json b/public/locales/en/footer.json index 80d5b29..1ef96d2 100644 --- a/public/locales/en/footer.json +++ b/public/locales/en/footer.json @@ -1,11 +1,11 @@ { - "help": "Get help", - "chef": "Become a chef", - "promotions": "Promotions", - "about": "About Cookiez", - "chef-around": " Chefs near me", - "view-foods": "View all home made foods", - "view-cities": "View all cities", - "view-chefs": "View all chefs", - "copyright": "Cookiez Copyright 2022" -} \ No newline at end of file + "help": "Get help", + "chef": "Become a chef", + "promotions": "Promotions", + "about": "About Cookiez", + "chef-around": " Chefs near me", + "view-foods": "View all home made foods", + "view-cities": "View all cities", + "view-chefs": "View all chefs", + "copyright": "Cookiez Copyright 2022" +} diff --git a/public/locales/en/hero.json b/public/locales/en/hero.json index d25d65a..708dceb 100644 --- a/public/locales/en/hero.json +++ b/public/locales/en/hero.json @@ -1,6 +1,6 @@ { - "title": " Fast delivery, delicious and cheaper", - "subtitle": "Find your favorite food and order in seconds", - "placeholder": "Enter a food name or location", - "search-button": "Find" -} \ No newline at end of file + "title": " Fast delivery, delicious and cheaper", + "subtitle": "Find your favorite food and order in seconds", + "placeholder": "Enter a food name or location", + "search-button": "Find" +} diff --git a/public/locales/en/landing-meals.json b/public/locales/en/landing-meals.json index 7317514..13280eb 100644 --- a/public/locales/en/landing-meals.json +++ b/public/locales/en/landing-meals.json @@ -1,5 +1,5 @@ { - "search": "Search", + "search": "Search", "categories": "Categories", "spanish-paella": "Spanish Paella", "price": "$6" diff --git a/public/locales/en/navbar.json b/public/locales/en/navbar.json index 38a043e..cbc511b 100644 --- a/public/locales/en/navbar.json +++ b/public/locales/en/navbar.json @@ -1,10 +1,9 @@ { - "signup": "Sign Up", - "login": "Login", - "add-new-food":" Add a new food", - "dashboard": "Dashboard", - "account-settings": "Account Settings", - "logout": "Logout", - "name": "{{name}}" - -} \ No newline at end of file + "signup": "Sign Up", + "login": "Login", + "add-new-food": " Add a new food", + "dashboard": "Dashboard", + "account-settings": "Account Settings", + "logout": "Logout", + "name": "{{name}}" +} diff --git a/public/locales/en/order.json b/public/locales/en/order.json index 7718e48..d4237e4 100644 --- a/public/locales/en/order.json +++ b/public/locales/en/order.json @@ -1,25 +1,24 @@ { - - "orders": "Orders", - "settings": "Payment settings", - "reviews": "Customer reviews", - "total": "Total orders", - "revenue": "Revenue", - "popular": "Popular orders", - "filter": "Filter", - "search": "Search by food name", - "date-btn": "Date range", - "status-btn": "Status", - "payment-btn": "Payment method", - "ref": "Ref.", - "date": "DATE", - "customer": "CUSTOMER", - "food": "FOOD", - "status": "STATUS", - "payment": "PAYMENT", - "price": "PRICE", - "fried-chips":"Fried Chips", - "sausage": "Sausage", - "preparing":"Preparing", - "credit-card":"Credit Card" -} \ No newline at end of file + "orders": "Orders", + "settings": "Payment settings", + "reviews": "Customer reviews", + "total": "Total orders", + "revenue": "Revenue", + "popular": "Popular orders", + "filter": "Filter", + "search": "Search by food name", + "date-btn": "Date range", + "status-btn": "Status", + "payment-btn": "Payment method", + "ref": "Ref.", + "date": "DATE", + "customer": "CUSTOMER", + "food": "FOOD", + "status": "STATUS", + "payment": "PAYMENT", + "price": "PRICE", + "fried-chips": "Fried Chips", + "sausage": "Sausage", + "preparing": "Preparing", + "credit-card": "Credit Card" +} diff --git a/public/locales/en/profile.json b/public/locales/en/profile.json index 02d6743..24c043b 100644 --- a/public/locales/en/profile.json +++ b/public/locales/en/profile.json @@ -1,8 +1,8 @@ { - "profile":"Profile", - "listed-foods": "Listed foods", - "orders": "Orders", - "payment-settings":"Payment settings", - "edit-profile":"Edit profile", - "logout":"Logout" -} \ No newline at end of file + "profile": "Profile", + "listed-foods": "Listed foods", + "orders": "Orders", + "payment-settings": "Payment settings", + "edit-profile": "Edit profile", + "logout": "Logout" +} diff --git a/public/locales/en/search-cities.json b/public/locales/en/search-cities.json index 9a87fa5..ce34973 100644 --- a/public/locales/en/search-cities.json +++ b/public/locales/en/search-cities.json @@ -1,5 +1,5 @@ { - "title": "Places where Cookiez is available", - "text": "We are currently providing services for limited cities. We plan to expand services across whole country very soon.Enter a city name", - "placeholder": "Enter a city name" -} \ No newline at end of file + "title": "Places where Cookiez is available", + "text": "We are currently providing services for limited cities. We plan to expand services across whole country very soon.Enter a city name", + "placeholder": "Enter a city name" +} diff --git a/public/locales/tr/cards.json b/public/locales/tr/cards.json index 7d27149..6d3891b 100644 --- a/public/locales/tr/cards.json +++ b/public/locales/tr/cards.json @@ -1,7 +1,7 @@ { - "card-title": "Ev yapımı yemekleri özlemedin mi?", - "card-subtitle": "Favori şefini, yemeğini veya mutfağını seç", - "card1-text": "Şefini seç ,yemeğini sipariş et ve anında kapında olsun", - "card2-text": "İlk siparişinde %15 indirimi kap!", - "card2-btn": "Sipariş Ver" + "card-title": "Ev yapımı yemekleri özlemedin mi?", + "card-subtitle": "Favori şefini, yemeğini veya mutfağını seç", + "card1-text": "Şefini seç ,yemeğini sipariş et ve anında kapında olsun", + "card2-text": "İlk siparişinde %15 indirimi kap!", + "card2-btn": "Sipariş Ver" } diff --git a/public/locales/tr/edit-account.json b/public/locales/tr/edit-account.json index c0c283c..3deeb93 100644 --- a/public/locales/tr/edit-account.json +++ b/public/locales/tr/edit-account.json @@ -1,7 +1,7 @@ { - "account": "Hesap Yenileme", - "phone-num": "Telefon Numarası", - "old-password": "Eski Şifre", - "new-password": "Yeni Şifre", - "save-btn": "Kaydet" -} \ No newline at end of file + "account": "Hesap Yenileme", + "phone-num": "Telefon Numarası", + "old-password": "Eski Şifre", + "new-password": "Yeni Şifre", + "save-btn": "Kaydet" +} diff --git a/public/locales/tr/landing-meals.json b/public/locales/tr/landing-meals.json index fde8b05..be72243 100644 --- a/public/locales/tr/landing-meals.json +++ b/public/locales/tr/landing-meals.json @@ -1,7 +1,6 @@ { - "search": "Ara", - "categories":"Kategoriler", - "spanish-paella": "İspanyol Paella", - "price": "60 tl" - -} \ No newline at end of file + "search": "Ara", + "categories": "Kategoriler", + "spanish-paella": "İspanyol Paella", + "price": "60 tl" +} diff --git a/public/locales/tr/navbar.json b/public/locales/tr/navbar.json index ecf4aed..979400d 100644 --- a/public/locales/tr/navbar.json +++ b/public/locales/tr/navbar.json @@ -1,10 +1,9 @@ { - "signup": "Kayıt OL", - "login": "Giriş Yap", - "add-new-food":" Yeni Yemek Ekle", - "dashboard": "Profil", - "account-settings": "Hesap Ayarları", - "logout": "Çıkış", - "name": "{{isim}}" - -} \ No newline at end of file + "signup": "Kayıt OL", + "login": "Giriş Yap", + "add-new-food": " Yeni Yemek Ekle", + "dashboard": "Profil", + "account-settings": "Hesap Ayarları", + "logout": "Çıkış", + "name": "{{isim}}" +} diff --git a/public/locales/tr/order.json b/public/locales/tr/order.json index 66631b6..8ba0766 100644 --- a/public/locales/tr/order.json +++ b/public/locales/tr/order.json @@ -1,26 +1,25 @@ { - - "orders": "Siparişler", - "payment-settings": "Ödeme ayarları", - "customer-reviews": "Müşteri yorumları", - "logout": "Çıkış", - "total": "Toplam siparişler", - "revenue": "Kazanç", - "popular": "Popüler siparişler", - "filter": "Filtrele", - "search": "Yemek ismiyle ara", - "date-btn": "Tarih aralığı", - "status-btn": "Sipariş durumu", - "payment-btn": "Ödeme yöntemi", - "ref": "Referans", - "date": "Tarih", - "customer": "Müşteri", - "food": "Yemek", - "status": "Sipariş durumu", - "payment": "Ödeme", - "price": "Fiyat", - "fried-chips":"Kızarmış Patates", - "sausage": "Sosis", - "preparing":"Hazırlanıyor", - "credit-card":"Kredi Kartı" - } \ No newline at end of file + "orders": "Siparişler", + "payment-settings": "Ödeme ayarları", + "customer-reviews": "Müşteri yorumları", + "logout": "Çıkış", + "total": "Toplam siparişler", + "revenue": "Kazanç", + "popular": "Popüler siparişler", + "filter": "Filtrele", + "search": "Yemek ismiyle ara", + "date-btn": "Tarih aralığı", + "status-btn": "Sipariş durumu", + "payment-btn": "Ödeme yöntemi", + "ref": "Referans", + "date": "Tarih", + "customer": "Müşteri", + "food": "Yemek", + "status": "Sipariş durumu", + "payment": "Ödeme", + "price": "Fiyat", + "fried-chips": "Kızarmış Patates", + "sausage": "Sosis", + "preparing": "Hazırlanıyor", + "credit-card": "Kredi Kartı" +} diff --git a/public/locales/tr/profile.json b/public/locales/tr/profile.json index 73854dd..d79f56d 100644 --- a/public/locales/tr/profile.json +++ b/public/locales/tr/profile.json @@ -1,8 +1,8 @@ { - "profile":"Profil", - "listed-foods": "Listelenmiş Yemekler", - "orders": "Siparişler", - "payment-settings":"Ödeme Ayarları", - "edit-profile":"Profili Düzenle", - "logout":"Çıkış" -} \ No newline at end of file + "profile": "Profil", + "listed-foods": "Listelenmiş Yemekler", + "orders": "Siparişler", + "payment-settings": "Ödeme Ayarları", + "edit-profile": "Profili Düzenle", + "logout": "Çıkış" +} diff --git a/src/components/AddMeal/__test__/AddMeal.test.jsx b/src/components/AddMeal/AddMeal.test.jsx similarity index 56% rename from src/components/AddMeal/__test__/AddMeal.test.jsx rename to src/components/AddMeal/AddMeal.test.jsx index ad0e4e5..d19ae61 100644 --- a/src/components/AddMeal/__test__/AddMeal.test.jsx +++ b/src/components/AddMeal/AddMeal.test.jsx @@ -1,9 +1,10 @@ +import React from "react"; import renderer from "react-test-renderer"; -import AddMeal from "../AddMeal"; +import AddMeal from "@/components/AddMeal/AddMeal"; -// eslint-disable-next-line no-undef -it("renders correctly", () => { +// eslint-disable-next-line +it("Dashboard Component", () => { const tree = renderer.create().toJSON(); // eslint-disable-next-line no-undef expect(tree).toMatchSnapshot(); diff --git a/src/components/AddMeal/__test__/__snapshots__/AddMeal.test.jsx.snap b/src/components/AddMeal/__snapshots__/AddMeal.test.jsx.snap similarity index 94% rename from src/components/AddMeal/__test__/__snapshots__/AddMeal.test.jsx.snap rename to src/components/AddMeal/__snapshots__/AddMeal.test.jsx.snap index 8338425..93d434e 100644 --- a/src/components/AddMeal/__test__/__snapshots__/AddMeal.test.jsx.snap +++ b/src/components/AddMeal/__snapshots__/AddMeal.test.jsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders correctly 1`] = ` +exports[`Dashboard Component 1`] = `
@@ -60,7 +60,7 @@ exports[`renders correctly 1`] = ` - Dietary + + dietary

    - Vegetarian + vegeterian
@@ -113,7 +114,7 @@ exports[`renders correctly 1`] = `
- Vegan + vegan
@@ -135,7 +136,7 @@ exports[`renders correctly 1`] = `
- Gluten Free + gluten-free
@@ -144,7 +145,7 @@ exports[`renders correctly 1`] = `

- Ingredients + ingredients

@@ -197,30 +198,32 @@ exports[`renders correctly 1`] = `

- Delivery in + delivery

- Price + price

`; diff --git a/src/components/Cards/__test__/Cards.test.jsx b/src/components/Cards/Cards.test.jsx similarity index 74% rename from src/components/Cards/__test__/Cards.test.jsx rename to src/components/Cards/Cards.test.jsx index ab49e5f..9a02285 100644 --- a/src/components/Cards/__test__/Cards.test.jsx +++ b/src/components/Cards/Cards.test.jsx @@ -1,10 +1,10 @@ import React from "react"; import renderer from "react-test-renderer"; -import Cards from "../Cards"; +import Cards from "@/components/Cards/Cards"; // eslint-disable-next-line -it("renders correctly", () => { +it("Dashboard Component", () => { const tree = renderer.create().toJSON(); // eslint-disable-next-line no-undef expect(tree).toMatchSnapshot(); diff --git a/src/components/Cards/__test__/__snapshots__/Cards.test.jsx.snap b/src/components/Cards/__snapshots__/Cards.test.jsx.snap similarity index 98% rename from src/components/Cards/__test__/__snapshots__/Cards.test.jsx.snap rename to src/components/Cards/__snapshots__/Cards.test.jsx.snap index 23f9002..fb84442 100644 --- a/src/components/Cards/__test__/__snapshots__/Cards.test.jsx.snap +++ b/src/components/Cards/__snapshots__/Cards.test.jsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders correctly 1`] = ` +exports[`Dashboard Component 1`] = `
@@ -13,12 +13,12 @@ exports[`renders correctly 1`] = `

- You’ve missed home made food? + card-title

- Pick your favorite chef, food or cousin. + card-subtitle

- Pick your chef order the food and get it when you want + card1-text
- Get a 15% discount for your first order! + card2-text +

diff --git a/src/components/EditAccount/__test__/EditAccount.test.jsx b/src/components/EditAccount/EditAccount.test.jsx similarity index 54% rename from src/components/EditAccount/__test__/EditAccount.test.jsx rename to src/components/EditAccount/EditAccount.test.jsx index 26c15b1..a498264 100644 --- a/src/components/EditAccount/__test__/EditAccount.test.jsx +++ b/src/components/EditAccount/EditAccount.test.jsx @@ -1,10 +1,11 @@ +import React from "react"; import renderer from "react-test-renderer"; -import EditAccount from "../EditAccount"; +import EditAccount from "./EditAccount"; // eslint-disable-next-line -it("Edit Account Component", () => { +it("Dashboard Component", () => { const tree = renderer.create().toJSON(); - // eslint-disable-next-line + // eslint-disable-next-line no-undef expect(tree).toMatchSnapshot(); }); diff --git a/src/components/EditAccount/__test__/__snapshots__/EditAccount.test.jsx.snap b/src/components/EditAccount/__snapshots__/EditAccount.test.jsx.snap similarity index 96% rename from src/components/EditAccount/__test__/__snapshots__/EditAccount.test.jsx.snap rename to src/components/EditAccount/__snapshots__/EditAccount.test.jsx.snap index 6f6e9fd..7722057 100644 --- a/src/components/EditAccount/__test__/__snapshots__/EditAccount.test.jsx.snap +++ b/src/components/EditAccount/__snapshots__/EditAccount.test.jsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Edit Account Component 1`] = ` +exports[`Dashboard Component 1`] = `
@@ -31,7 +31,7 @@ exports[`Edit Account Component 1`] = `

- Edit Your Account + account

@@ -180,7 +180,7 @@ exports[`Edit Account Component 1`] = ` className="rounded border text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none" id="oldPass" onChange={[Function]} - placeholder="Old Password" + placeholder="old-password" type="password" value="" /> @@ -188,14 +188,14 @@ exports[`Edit Account Component 1`] = ` className="rounded border text-sm font-bold leading-tight text-gray-700 shadow focus:outline-none" id="newPass" onChange={[Function]} - placeholder="New Password" + placeholder="new-password" type="password" value="" />
diff --git a/src/components/Footer/Footer.test.jsx b/src/components/Footer/Footer.test.jsx new file mode 100644 index 0000000..d413854 --- /dev/null +++ b/src/components/Footer/Footer.test.jsx @@ -0,0 +1,11 @@ +import React from "react"; +import renderer from "react-test-renderer"; + +import Footer from "./Footer"; + +// eslint-disable-next-line +it("Dashboard Component", () => { + const tree = renderer.create(
).toJSON(); + // eslint-disable-next-line no-undef + expect(tree).toMatchSnapshot(); +}); diff --git a/src/components/Footer/__snapshots__/Footer.test.jsx.snap b/src/components/Footer/__snapshots__/Footer.test.jsx.snap new file mode 100644 index 0000000..36c89e2 --- /dev/null +++ b/src/components/Footer/__snapshots__/Footer.test.jsx.snap @@ -0,0 +1,199 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Dashboard Component 1`] = ` + +`; diff --git a/src/components/Hero/__snapshots__/Hero.test.jsx.snap b/src/components/Hero/__snapshots__/Hero.test.jsx.snap index d806109..9cc0c41 100644 --- a/src/components/Hero/__snapshots__/Hero.test.jsx.snap +++ b/src/components/Hero/__snapshots__/Hero.test.jsx.snap @@ -1,47 +1,34 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Hero Component 1`] = ` -

- Home made - - - healthy - - - food + title

-
- Find your favorite food and order in seconds -
@@ -50,13 +37,18 @@ exports[`Hero Component 1`] = ` className="search-btn" >
+
+ subtitle +
-
+ `; diff --git a/src/components/LandingMeals/__snapshots__/LandingMeals.test.jsx.snap b/src/components/LandingMeals/__snapshots__/LandingMeals.test.jsx.snap index 952a073..d33f5b9 100644 --- a/src/components/LandingMeals/__snapshots__/LandingMeals.test.jsx.snap +++ b/src/components/LandingMeals/__snapshots__/LandingMeals.test.jsx.snap @@ -15,14 +15,14 @@ exports[`renders correctly 1`] = `

- Categories + categories

    { + const tree = renderer.create().toJSON(); + // eslint-disable-next-line no-undef + expect(tree).toMatchSnapshot(); +}); diff --git a/src/components/Layout/__snapshots__/Layout.test.jsx.snap b/src/components/Layout/__snapshots__/Layout.test.jsx.snap new file mode 100644 index 0000000..f852e35 --- /dev/null +++ b/src/components/Layout/__snapshots__/Layout.test.jsx.snap @@ -0,0 +1,363 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Dashboard Component 1`] = ` +Array [ + , + , +] +`; diff --git a/src/components/Navbar/__snapshots__/Navbar.test.jsx.snap b/src/components/Navbar/__snapshots__/Navbar.test.jsx.snap index cf6031a..7f9f1f5 100644 --- a/src/components/Navbar/__snapshots__/Navbar.test.jsx.snap +++ b/src/components/Navbar/__snapshots__/Navbar.test.jsx.snap @@ -2,7 +2,7 @@ exports[`Navbar Component 1`] = `

- Sausage + sausage

- Preparing + preparing

- Credit Card + credit-card

@@ -288,19 +294,19 @@ exports[`Navbar Component 1`] = `

- Sausage + sausage

- Preparing + preparing

- Credit Card + credit-card

@@ -329,19 +335,19 @@ exports[`Navbar Component 1`] = `

- Sausage + sausage

- Preparing + preparing

- Credit Card + credit-card

diff --git a/src/components/SearchCities/__test__/SearchCities.test.jsx b/src/components/SearchCities/SearchCities.test.jsx similarity index 65% rename from src/components/SearchCities/__test__/SearchCities.test.jsx rename to src/components/SearchCities/SearchCities.test.jsx index 264bf87..73024e0 100644 --- a/src/components/SearchCities/__test__/SearchCities.test.jsx +++ b/src/components/SearchCities/SearchCities.test.jsx @@ -1,10 +1,10 @@ import React from "react"; import renderer from "react-test-renderer"; -import SearchCities from "../SearchCities"; +import SearchCities from "./SearchCities"; -// eslint-disable-next-line no-undef -it("renders correctly", () => { +// eslint-disable-next-line +it("Dashboard Component", () => { const tree = renderer.create().toJSON(); // eslint-disable-next-line no-undef expect(tree).toMatchSnapshot(); diff --git a/src/components/SearchCities/__test__/__snapshots__/SearchCities.test.jsx.snap b/src/components/SearchCities/__snapshots__/SearchCities.test.jsx.snap similarity index 76% rename from src/components/SearchCities/__test__/__snapshots__/SearchCities.test.jsx.snap rename to src/components/SearchCities/__snapshots__/SearchCities.test.jsx.snap index 5f48ea1..3c804a3 100644 --- a/src/components/SearchCities/__test__/__snapshots__/SearchCities.test.jsx.snap +++ b/src/components/SearchCities/__snapshots__/SearchCities.test.jsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders correctly 1`] = ` +exports[`Dashboard Component 1`] = `
@@ -10,12 +10,12 @@ exports[`renders correctly 1`] = `

- Places where Cookiez is available + title

- We are currently providing services for limited cities. We plan to expand services across whole country very soon. + text

{ +it("Dashboard Component", () => { const tree = renderer.create().toJSON(); // eslint-disable-next-line no-undef expect(tree).toMatchSnapshot(); diff --git a/src/components/SignUpForm/__test__/__snapshots__/SignUpForm.test.jsx.snap b/src/components/SignUpForm/__snapshots__/SignUpForm.test.jsx.snap similarity index 93% rename from src/components/SignUpForm/__test__/__snapshots__/SignUpForm.test.jsx.snap rename to src/components/SignUpForm/__snapshots__/SignUpForm.test.jsx.snap index 6356d96..af58869 100644 --- a/src/components/SignUpForm/__test__/__snapshots__/SignUpForm.test.jsx.snap +++ b/src/components/SignUpForm/__snapshots__/SignUpForm.test.jsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Create Account Form Component 1`] = ` +exports[`Dashboard Component 1`] = `
@@ -10,7 +10,7 @@ exports[`Create Account Form Component 1`] = `

- Create An Account + create-account

- I agree to Terms and Conditions + terms-conditions
- Already Have An Account? + + have-account - Sign in + + signin