diff --git a/package-lock.json b/package-lock.json index c8c7438..63861ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,8 @@ "react-icon": "^1.0.0", "react-icons": "^4.11.0", "react-router-dom": "^6.3.0", - "react-test-renderer": "^18.2.0" + "react-test-renderer": "^18.2.0", + "tailwind-merge": "^1.14.0" }, "devDependencies": { "@commitlint/cli": "^17.7.2", @@ -14871,6 +14872,15 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "node_modules/tailwind-merge": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-1.14.0.tgz", + "integrity": "sha512-3mFKyCo/MBcgyOTlrY8T7odzZFx+w+qKSMAmdFzRvqBfLlSigU6TZnlFHK0lkMwj9Bj8OYU+9yW9lmGuS0QEnQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/dcastil" + } + }, "node_modules/tailwindcss": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", diff --git a/package.json b/package.json index 374ae9f..78e4aac 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "react-icon": "^1.0.0", "react-icons": "^4.11.0", "react-router-dom": "^6.3.0", - "react-test-renderer": "^18.2.0" + "react-test-renderer": "^18.2.0", + "tailwind-merge": "^1.14.0" }, "devDependencies": { "@commitlint/cli": "^17.7.2", diff --git a/src/components/Buttons/Button.jsx b/src/components/Buttons/Button.jsx new file mode 100644 index 0000000..f6fec9a --- /dev/null +++ b/src/components/Buttons/Button.jsx @@ -0,0 +1,17 @@ +import React from "react"; +import { twMerge } from "tailwind-merge"; +function Button({ children, className, onClick }) { + return ( + + ); +} + +export default Button; diff --git a/src/components/Buttons/Buttons.jsx b/src/components/Buttons/Buttons.jsx deleted file mode 100644 index 651fc77..0000000 --- a/src/components/Buttons/Buttons.jsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from "react"; - -function Buttons() { - return
Buttons
; -} - -export default Buttons; diff --git a/src/components/Buttons/__test__/Button.test.js b/src/components/Buttons/__test__/Button.test.js new file mode 100644 index 0000000..da92a17 --- /dev/null +++ b/src/components/Buttons/__test__/Button.test.js @@ -0,0 +1,7 @@ +import renderer from "react-test-renderer"; +import Button from "../Button"; + +it("renders correctly", () => { + const tree = renderer.create( + + + + ); } export default ProductCard; diff --git a/src/components/ProductCard/__test__/ProductCard.test.js b/src/components/ProductCard/__test__/ProductCard.test.js new file mode 100644 index 0000000..2dff3d2 --- /dev/null +++ b/src/components/ProductCard/__test__/ProductCard.test.js @@ -0,0 +1,8 @@ +import renderer from "react-test-renderer"; + +import ProductCard from "../ProductCard"; + +it("renders correctly", () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); +}); diff --git a/src/components/ProductCard/__test__/__snapshots__/ProductCard.test.js.snap b/src/components/ProductCard/__test__/__snapshots__/ProductCard.test.js.snap new file mode 100644 index 0000000..a413633 --- /dev/null +++ b/src/components/ProductCard/__test__/__snapshots__/ProductCard.test.js.snap @@ -0,0 +1,93 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders correctly 1`] = ` +
+
+
+ Picture of the product +
+

+ Sale +

+
+
+
+
+

+ Nike Air MX Super 2500 +

+
+

+ category +

+

+ location +

+
+
+

+ $449 +

+ +
+
+
+`; diff --git a/src/components/UnderBar/UnderBar.jsx b/src/components/UnderBar/UnderBar.jsx index cc42d60..6802ebb 100644 --- a/src/components/UnderBar/UnderBar.jsx +++ b/src/components/UnderBar/UnderBar.jsx @@ -1,7 +1,90 @@ import React from "react"; - -function UnderBar() { - return
UnderBar
; +import Link from "next/link"; +import { twMerge } from "tailwind-merge"; +function UnderBar({ className }) { + return ( +
+ +
+ ); } export default UnderBar; diff --git a/src/components/UnderBar/__test__/UnderBar.test.js b/src/components/UnderBar/__test__/UnderBar.test.js new file mode 100644 index 0000000..c906fff --- /dev/null +++ b/src/components/UnderBar/__test__/UnderBar.test.js @@ -0,0 +1,7 @@ +import renderer from "react-test-renderer"; +import UnderBar from "../UnderBar"; + +it("renders correctly", () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); +}); diff --git a/src/components/UnderBar/__test__/__snapshots__/UnderBar.test.js.snap b/src/components/UnderBar/__test__/__snapshots__/UnderBar.test.js.snap new file mode 100644 index 0000000..3d3a59d --- /dev/null +++ b/src/components/UnderBar/__test__/__snapshots__/UnderBar.test.js.snap @@ -0,0 +1,111 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders correctly 1`] = ` +
+ +
+`; diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 778acf5..73e6557 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -1,13 +1,18 @@ +import { collection, getDocs } from "firebase/firestore"; import Link from "next/link"; import { useEffect } from "react"; import { useTranslation } from "next-i18next"; import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import * as React from "react"; -import { db } from "@/util/firebase"; -import { collection, getDocs } from "firebase/firestore"; + +import ProductCard from "@/components/ProductCard/ProductCard"; + import Layout from "@/layout/Layout"; + import SearchBar from "@/components/SearchBar/SearchBar"; import { onSnapshot } from "firebase/firestore"; +import { db } from "@/util/firebase"; + export default function HomePage() { const { t } = useTranslation("common"); @@ -22,6 +27,7 @@ export default function HomePage() { }); }, []); return ( +

{t("test")}

@@ -42,6 +48,7 @@ export default function HomePage() {
+ ); }