Skip to content

Commit

Permalink
feat: refactor not found page for server component
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpastor committed Jun 28, 2023
1 parent 49ea4bb commit d58bf96
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
32 changes: 12 additions & 20 deletions src/app/_components/not-found-page/home-button.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
"use client";

import { Home as HomeIcon } from "@mui/icons-material";
import { Button } from "@mui/material";
import { useRouter } from "next/navigation";
import Link from "next/link";
import { ReactElement } from "react";

export const HomeButton = (): ReactElement => {
const { push } = useRouter();

const handleClick = (): void => {
push("/");
};

return (
<Button
onClick={handleClick}
startIcon={<HomeIcon />}
>
Accueil
</Button>
);
};
import { HomeIcon } from "./home-icon";

export const HomeButton = (): ReactElement => (
<Button
component={Link}
href="/"
startIcon={<HomeIcon />}
>
Accueil
</Button>
);
8 changes: 8 additions & 0 deletions src/app/_components/not-found-page/home-icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use client";

import { Home } from "@mui/icons-material";
import { ReactElement } from "react";

export const HomeIcon = (): ReactElement => (
<Home />
);
2 changes: 2 additions & 0 deletions src/components/ad.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { ReactElement, useEffect } from "react";

declare global {
Expand Down
8 changes: 4 additions & 4 deletions src/components/highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { ReactElement } from "react";

import { removeAccents } from "@utils/misc/string";

const massageString = (value: string): string => (
removeAccents(value).toLocaleLowerCase()
);

interface Props {
word: string;
highlight: string;
}

const massageString = (value: string): string => (
removeAccents(value).toLocaleLowerCase()
);

export const Highlight = ({ word, highlight }: Props): ReactElement => {
const massagedWord: string = massageString(word);
const massagedHighlight: string = massageString(highlight);
Expand Down

0 comments on commit d58bf96

Please sign in to comment.