shellphone.app/app/core/layouts/layout/footer.tsx

68 lines
1.6 KiB
TypeScript
Raw Normal View History

import type { ReactNode } from "react";
2021-07-31 17:22:48 +00:00
import { Link, useRouter } from "blitz";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
2021-07-18 15:32:45 +00:00
import {
faPhoneAlt as fasPhone,
faTh as fasTh,
faComments as fasComments,
faCog as fasCog,
} from "@fortawesome/pro-solid-svg-icons";
2021-08-30 21:15:30 +00:00
import clsx from "clsx";
2021-07-18 15:32:45 +00:00
export default function Footer() {
return (
2021-08-30 21:15:30 +00:00
<footer
className="grid grid-cols-4 bg-[#F7F7F7] border-t border-gray-400 border-opacity-25 py-3"
style={{ flex: "0 0 50px" }}
>
2021-07-18 15:32:45 +00:00
<NavLink
label="Calls"
path="/calls"
2021-08-30 21:15:30 +00:00
icon={<FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasPhone} />}
2021-07-18 15:32:45 +00:00
/>
<NavLink
label="Keypad"
path="/keypad"
2021-08-30 21:15:30 +00:00
icon={<FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasTh} />}
2021-07-18 15:32:45 +00:00
/>
<NavLink
label="Messages"
path="/messages"
2021-08-30 21:15:30 +00:00
icon={<FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasComments} />}
2021-07-18 15:32:45 +00:00
/>
<NavLink
label="Settings"
path="/settings"
2021-08-30 21:15:30 +00:00
icon={<FontAwesomeIcon size="lg" className="w-6 h-6" icon={fasCog} />}
2021-07-18 15:32:45 +00:00
/>
</footer>
);
2021-07-18 15:32:45 +00:00
}
type NavLinkProps = {
path: string;
label: string;
2021-08-30 21:15:30 +00:00
icon: ReactNode;
};
2021-07-18 15:32:45 +00:00
2021-08-30 21:15:30 +00:00
function NavLink({ path, label, icon }: NavLinkProps) {
const router = useRouter();
const isActiveRoute = router.pathname.startsWith(path);
2021-07-18 15:32:45 +00:00
return (
<div className="flex flex-col items-center justify-around h-full">
<Link href={path}>
2021-08-30 21:15:30 +00:00
<a
className={clsx("flex flex-col items-center", {
"text-[#007AFF]": isActiveRoute,
"text-[#959595]": !isActiveRoute,
})}
>
2021-07-18 15:32:45 +00:00
{icon}
<span className="text-xs">{label}</span>
</a>
</Link>
</div>
);
2021-07-18 15:32:45 +00:00
}