Skip to content

Commit

Permalink
[Issue 1179] Search Page Boilerplate (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySteiner authored Feb 15, 2024
1 parent 5e0beb9 commit 24b8295
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
21 changes: 21 additions & 0 deletions frontend/src/pages/search.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { GetStaticProps, NextPage } from "next";

import { serverSideTranslations } from "next-i18next/serverSideTranslations";

const Search: NextPage = () => {
return <>Search Boilerplate</>;
};

// Change this to GetServerSideProps if you're using server-side rendering
export const getStaticProps: GetStaticProps = async ({ locale }) => {
const translations = await serverSideTranslations(locale ?? "en");

// TODO: update the statement below with a feature flag check
const hideSearchPage = true;
// redirects to default 404 page
if (hideSearchPage) return { notFound: true };

return { props: { ...translations } };
};

export default Search;
10 changes: 10 additions & 0 deletions frontend/stories/pages/search.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Meta } from "@storybook/react";
import Search from "src/pages/search";

const meta: Meta<typeof Search> = {
title: "Pages/Search",
component: Search,
};
export default meta;

export const Preview = {};
12 changes: 12 additions & 0 deletions frontend/tests/pages/search.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { render, waitFor } from "@testing-library/react";
import { axe } from "jest-axe";
import Search from "src/pages/search";

describe("Search", () => {
it("passes accessibility scan", async () => {
const { container } = render(<Search />);
const results = await waitFor(() => axe(container));

expect(results).toHaveNoViolations();
});
});

0 comments on commit 24b8295

Please sign in to comment.