Skip to content

Commit

Permalink
finalized filter results component (#99)
Browse files Browse the repository at this point in the history
* finalized filter results component

* updated snapshot

* updated snapshot

Co-authored-by: Allan <[email protected]>
Co-authored-by: allan <[email protected]>
  • Loading branch information
3 people authored Nov 6, 2022
1 parent 63a3583 commit 34e3341
Show file tree
Hide file tree
Showing 12 changed files with 755 additions and 35 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
"@fortawesome/free-regular-svg-icons": "^6.2.0",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@hookform/resolvers": "^2.9.10",
"@headlessui/react": "^1.7.4",
"@heroicons/react": "^2.0.12",
"@hookform/resolvers": "^2.9.10",
"@reduxjs/toolkit": "^1.8.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.0.1",
"@testing-library/user-event": "^14.1.1",
"babel-plugin-macros": "^3.1.0",
"font-awesome": "^4.7.0",
"eslint-import-resolver-node": "^0.3.6",
"firebase": "^9.13.0",
"font-awesome": "^4.7.0",
"i18next": "^22.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.38.0",
"react-icons": "^4.6.0",
"react-i18next": "^12.0.0",
"react-redux": "^8.0.1",
"react-router-dom": "6",
Expand Down Expand Up @@ -70,10 +70,10 @@
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"file-loader": "^6.2.0",
"jest": "^29.2.2",
"postcss": "^8.4.17",
"prettier": "2.7.1",
"tailwindcss": "^3.2.1",
"jest": "^29.2.2",
"react-test-renderer": "^18.2.0"
"react-test-renderer": "^18.2.0",
"tailwindcss": "^3.2.1"
}
}
Binary file added public/assets/filterResults/EAB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/filterResults/Murex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import Login from "./components/Login/Login";
import SignUp from "./components/signup/SignUp";
import CompanyShowcaseComponent from "./components/companyShowcaseComponent/CompanyShowcaseComponent";
import { showCaseData } from "./data/showCaseData";
import FilterResults from './components/FilterResults/FilterResults';
import { filterData } from './data/filterData';
import "./App.css";
import SaveButton from "./components/UI/Button/SaveButton";
import Categories from "./components/Categories/Categories";
Expand Down Expand Up @@ -94,12 +96,14 @@ const header = [
{ title: "Date", id: 3 },
{ title: "", id: 4 },
];

function App() {
const { t } = useTranslation();
return (
<div className="App">
<Navbar />
<Hero />
<FilterResults filterData={ filterData }/>
<Login />
<BasicInfoEdit />
<SignUp />
Expand Down
69 changes: 69 additions & 0 deletions src/components/FilterResults/FilterButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Fragment } from "react";
import { Menu, Transition } from "@headlessui/react";

function FilterButton() {
return (
<Menu
as="div"
data-testid="filter-button"
className="relative inline-block text-left"
>
<div>
<Menu.Button
data-testid="filter-botton-toggle"
className="rounded-full bg-gray-300 mr-5 mt-5 pl-5 pr-5 text-lg duration-500 hover:bg-accent"
>
{" "}
Sort results by
</Menu.Button>
</div>

<Transition
as={Fragment}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items className="absolute left-0 md:right-0 z-10 mt-2 w-40 origin-center md:origin-top-right rounded-md bg-accent shadow-lg ring-1 ring-white ring-opacity-5 focus:outline-none">
<div>
<Menu.Item>
{({ active }) => (
<div
data-testid="language-button-option"
aria-hidden="true"
className={`${
active
? "bg-white text-secondary rounded"
: "text-black-500"
}`}
>
<h3>Newest</h3>
</div>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<div
data-testid="language-button-option"
aria-hidden="true"
className={`${
active
? "bg-white text-secondary rounded"
: "text-black-500"
}`}
>
<h3>Oldest</h3>
</div>
)}
</Menu.Item>
</div>
</Menu.Items>
</Transition>
</Menu>
);
}

export default FilterButton;
62 changes: 62 additions & 0 deletions src/components/FilterResults/FilterResults.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faBookmark } from "@fortawesome/free-regular-svg-icons";
import FilterButton from "./FilterButton";

function FilterResults({ filterData }) {
const jobCard = filterData.map((job) => {
return (
<div
key={job.id}
className="rounded-md grid justify-items-center gap-3 m-5 bg-white drop-shadow-xl grid-cols-2 grid-rows-4 md:grid-cols-5 md:grid-rows-2"
>
<img
className="order-1 col-span-2 h-20 md:row-span-2 md:col-span-1 md:scale-60 object-contain md:h-28 md:order-1"
src={job.src}
alt="hiring company logo"
/>
<h2 className="order-4 font-semibold text-center md:font-semibold md:mt-3 md:order-2">
{job.position}
</h2>
<h2 className="order-5 md:font-semibold md:mt-3 md:order-3">
{job.jobModel}
</h2>
<h2 className="order-6 font-semibold md:font-semibold md:mt-3 md:order-4 ">
{job.salary}
</h2>
<FontAwesomeIcon
className="order-3 md:mt-3 md:order-5"
icon={faBookmark}
/>
<h2 className="order-8 font-semibold mb-5 md:font-normal md:order-6">
{" "}
{job.employer}
</h2>
<h2 className="order-9 mb-5 md:order-7"> {job.jobType}</h2>
<h2 className="order-7 md:order-8"> {job.payFreq}</h2>
<h2 className="order-2 font-semibold md:font-normal md:order-9">
{" "}
{job.postingDate}
</h2>
</div>
);
});
return (
<div className="bg-gray-500/5">
<div className="flex justify-between">
<h2 className="ml-5 mt-5 text-lg">
{" "}
Total{" "}
<span className="text-accent font-semibold">
{" "}
{filterData.length}{" "}
</span>
Results
</h2>
<FilterButton />
</div>
{jobCard}
</div>
);
}

export default FilterResults;
10 changes: 10 additions & 0 deletions src/components/FilterResults/__tests__/FilterResults.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import renderer from "react-test-renderer";
import FilterResults from "../FilterResults";
import { filterData } from "../../../data/filterData";

it("renders Company Showcase Component correctly", () => {
const tree = renderer
.create(<FilterResults filterData={filterData} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
Loading

0 comments on commit 34e3341

Please sign in to comment.